Lack of affordable housing is the number one cause of homelessness and it's not even close (eg [1]). California, in particular, votes in measures to fund housing the homeless but it doesn't really get spent. Why? Because residents, developers and politicians do everything they can to resist building anything to house the homeless in any capacity.
We have decades of long-term incarceration for minor drug possession to show this is not an effective strategy. That's what led to drug decriminzation after the crime panic of the 1980s and 1990s. Decriminalizing drug use is good. If people don't want to see it (which I get), maybe they should do something to house such people, particularly because homelessness itself is a major cause of drug abuse as such people turn to self-medication.
[1]: https://caplinnews.fiu.edu/lack-of-affordable-housing-a-lead...