Going inFront of and Behind Sprites

Is there a way that I can change the layering of sprites depending on what direction I’m coming from or where I am in respect to the sprite?

I’m looking to do something such that it looks like this:
https://www.google.com.au/search?q=earthbound+npc&rlz=1C1ASUC_enAU623AU623&source=lnms&tbm=isch&sa=X&ved=0ahUKEwi4qqm7hsPYAhUFT7wKHQzaCLEQ_AUICigB&biw=1920&bih=949#imgrc=vURrFJJmSM4N-M:

Where, if I’m coming from an NPC from the front, then I will go over them, but if I come up to them from behind then they layer over me?

Could you manipulate the z position of GameObjects based on their z position? So if I am lower on the y (vertical) coordinate, I’ve got a lower z value and am more prominent than someone higher up?

Not sure on all the implications of this, but I feel it should work.

You can use the custom sorting axis to make objects on the same sorting layer & order sort based on their vertical position.