How do I constrain the camera to the z axis?

I’m making a 2D side-scroller and I’m trying to constrain the camera so it can’t go past min:500cm and :1000cm on the z axis whilst still being able to freely follow the player in between those boundaries, its on a spring arm attached to the player sprite. Every way I’ve tried ends up with a slight flicker on screen.

Any help is appreciated.

Hi

How are you stopping it move?

This is my current way of doing it, but any sprite on the same plane flickers each I turn my character