What's the best way of implementing this kind of sorting algorithm?
Being tongue-in-cheek, I'd suggest using the library implementation of quicksort, with the distance to the target string as the sorting key.
That's of course not a helpful answer. Why not? Because what you really want to know is "What's a good difference metric for strings?"
The answer to the real qusetion is, sadly, "it depends"; it depends on which properties of the distance you care about.
That being said, read up on the Levenstein Distance and what it really says about the strings.
You can modify the basic algorithm to skew the metric in favor of identical characters occurring in long runs by fiddling with the weighting of different steps in the dynamic programming matrix.
You can also use the Soundex algorithm, which says something about which strings sound similar (but that works best for short strings; I don't know what kind of input you use).
If the strings are of equal length, you can also use the hamming distance (count the number of indexes where the strings differ). That can probably be generalized to something by counting (unilaterally) non-existing indexes as always different, which gives you something Levenstein-like (kinda' sorta' maybe).
The short version: it depends. I've given some input, but I can't say which is going to be a good decision for you without some more information from you.