Image only in focus when lens is touching slide

Hey,
I only seem to be able to get focus when it is at the limit of its z movement. I am using the picamera V2.1 and lens_spacer_picamera_2_pilens_LS65 lens spacer.

I have attached an image, does the lens look like it is seated correctly?

For clarification, in your post do you mean the limit of hitting the slide, or the limit of the z-actuator travel?

Apologies, it is actually physically hitting the slide

In the optics of this, if the camera is further from the lens, then the focused object will be closer to the lens. If you are hitting the slide it suggests that the lens or camera are not pushed far enough into the spacer.

Perfect! Thank you for the explanation. I will try this now,

I printed the spacer 10% shorter on the z stage and this seems to have helped it. Thanks William!

10% is quite a lot shorter. It will work, but gives slightly lower magnification.