The z sort should place the higher y on top and cover it.
If the y is at the bottom of the object.
Poking out of the bottom or top is exactly what I would expect if the thing that's moving is bigger than the thing in front of it.
If you want it always hidden when behind something then you may need to change the collision polygons to bounding box, or make dummy detectors.