https://en.wikipedia.org/wiki/Levenshtein_distanceAnything below 5 in distance gets rejected, try again, please.
While you get to change password you make 2 boxes with current and new of course and do your comparisons on it, just to explain you still keep passwords hashed.