If you want to have any chance of achieving this one, the drug in question has to be obtained from a pharmaceutical channel rather than a black market channel.
That means legalizing sale in some way too, otherwise the drugs themselves will continue to be impure and unsafe.
Luckily the drugs that are the most problematic are already legal, they just require a prescription to obtain.
So in the short term the answer is to start treating the drug aspect of drug addiction as the medical issue that it is, and allow doctors to write prescriptions to addicts.
Then you'll have a much easier time providing them assistance finding a job, education, safe housing, and medical care for any underlying condition they might have, which most of them really, really want.