Depth Movement Type Stuff

Hey, I made this thing where it basically makes the player’s depth change based on the Y axis of the player to give it a quasi-3D type effect. How would I hittest with only things on the same depth?