i dont think much is a deterrent to those on drugs. what does deter them is being physically removed from the situation by being in prison.
That’s exactly like a prison, but probably with unconstitutionally poor conditions by design, not better than a prison, and probably unconstitutional mechanisms for sending people into them as well.
Better than prison (demonstrated, repeatedly) for dealing with addiction and related crime is funding community treatment for substance use disorders, with studies consistently showing both crime reductions and criminal justice cost savings of several multiples of the marginal funding devoted to drug treatment.
But “tough on crime” via greater criminalization makes an easier political soundbite, even if its manifestly worse at actually dealing with crime.