For the sliding window, that works when the characters are "replaced".
Example:
"abcde"
"abcxx"
However, I believe the question must be specified more specifically. If removal of characters is legal, and the removal of one character is still considered "differing" by one character, then the sliding window solution gets more complicated:
Example:
"abcde"
"cde"