There are simple, expensive answers: highly diligent social workers focusing on homelessness outreach + massive affordable housing construction that crunches housing prices. Regulate the substances but have them available to addicts, and make sure fentanyl is out of the supply chain, and make selling drugs outside the regulated system a felony.
Not saying you’re wrong in the context of your locale, but there are many places around the world that are not plagued with these problems and have dealt with them in very different ways.