Snap to mesh issues with Z and X axis constraints
There is another way to solve this (that may work), using the shrinkwrap modifier. Do this before joining the objects.


Create a vertex group with the vertices you want to snap.
Add a shrinkwrap modifier.
Set your vertex group as the one affected.
Set mode to "Project".
Select the axis to project along.
Tick both positive and negative (maybe you need to do this).


Like this: