Locking teleport location to the nearest valid location

My game has a teleport move similar to Dishonored’s shift. My current system simply checks whether the area being looked at is valid ground, but I haven’t been able to find out a way to be able to lock on to ledges and such. I was planning on using the height mesh generated when the nav mesh is baked but there seems to be no way to access that. Anyway that wouldn’t achieve what I wanted very well. Does anybody have any insight on how locking similar to Dishonored is done? Any tips are appreciated.

Valorant contains a similar move with the locking target:

Make those be “valid ground” too!

If that causes unwanted consideration of areas to be valid ground, then you might have to introduce the notion of “valid to walk on ground” and “valid to walk on OR to teleport to ground” and author your levels appropriately.