The limit switch on the Z axis of my benchtop mill has an adjustable set screw with locking nut as the physical stop, it is adjusted so that the limit/home switch acts before the stop and so the switch can't be squashed,

- Nick