Heroin/optiates are particularly interesting to me because of how huge the gap between the risk of pure versions of the safer opiates are vs. the risks incurred by addicts who end up shooting up street-quality heroin.
E.g. a common route to shooting up heroin that's often cut with anything from other drugs to 50% brick dust, or worse, is to start with strong prescription opiates like codeine or oxycodone (or, indeed, prescription heron - see below), become addicted, and rather than have healthcare systems treat this properly, risk having the prescriptions withdrawn if the doctor gets suspicious, get forced onto the black market, eventually find that too expensive, and try heroin as a far cheaper alternative (despite costs than can be tens to hundreds of times more expensive than the cost of medical grade prescription heroin).
Heroin itself is commonly prescribed as a safer alternative to morphine in some countries (UK for example) for things like post-op pain under the names diacetylmorphine or diamorphine - primarily because you need much smaller doses to get the desired effect with heroin than morphine.
There's pretty much no scenario where someone who is willing to risk injecting themselves with an unknown mix of substances of unknown purity, and the potential to include stuff like brick dust, bought at rates extortionate enough to drive quite a few into crime or prostitution, would not be vastly better off with easy access to a $10-$20/day medical grade supply (an amount in line with actual costs of medical grade heroin) of a drug that is safe enough that we regularly hand out prescriptions for just as risky substances solely for pain management (e.g. an ex of mine gets ongoing prescriptions high doses of tramadol and cocodamol (codeing + paracetamol/acetaminophen) for period pain - high enough doses that she avoids taking them as much as possible because she finds the effects deeply unpleasant).
I've pointed out before that I personally see anyone who still votes to continue the current legal regime for drugs as morally not much better than a serial murderer given the amount of deaths - and other suffering - these laws cause, even if you ignore all the misery around the illegal production and focus only on users.