So, let me get this straight...
You have a character following the player, and
if the player gets X distance away from the character, then you want the character to teleport to the player?
So in other words, if the charater gets hung on an obstacle, then he would get teleported out of it.
Just do it backwards...
Have the character following the player like he should.
Then if he gets X distance away, then move the player back to get him unhung. (by leading him clear of obstacle)
As long as the distance was not a large number, then you wouldn't set the player back far at all.
It would be better than getting on the other side of the map and discovering you lost them only having to backtrack the whole map.
:state=0,plrdistwithin=100:animate=1,rotatetoplr
:state=0,plrdistfurther=100:animate=5,rotatetoplr,followplr
:state=0,plrdistfurther=600:plrmoveto=charactersNAMEhere
Hopefully the player will run clear of obstacles in the first place.
If not, then they soon will after getting called back a few times.
You could get fancy and display a HUD when moving the character explaining that the follower got lost, but thats up to you.