On the whole it isn't due to a lack of housing but a lack of adequate care for addiction issues, mental health issues and counselling for childhood trauma.
Most homeless people have drug addictions, alcohol addictions or mental health issues. Many have suffered abuse or trauma in childhood. Most will deny or try to hide their addictions but in my experience at least 90% will be drug users. People try to kid themselves that 'there are some who are drug users but most aren't' or 'well I'd be driven to drugs if I was on the steeet too', but in my experience there are very few long term homeless people who aren't addicted to drugs and in the vast majority of cases they became homeless because of their drug addiction, not the other way around.
I was street homeless for a while and the fact that I wasn't drinking or using drugs was a major talking point among the other homeless people I knew, because it was so unusual. I managed to get into accommodation and reintegrated into 'normal' life very quickly. If you genuinely have no issues except needing a roof over your head you can generally get off the streets quite quickly.
The problem is not lack of accommodation, there's plenty of accommodation. Most of the homeless people you meet will have been repeatedly housed and lost that accommodation each time due to antisocial behaviour, rent arrears etc. stemming from their addictions and chaotic lifestyles. Often these people have never lived a 'normal' life so even when they're given accommodation and financial help they struggle to sustain it. Accommodation and even rehab does nothing to address the underlying issues which drove them to become homeless and addicted in the first place.
What does help is long term residential rehab, where they don't just physically detox from drugs but where they receive counselling and a high level of support to help them learn the skills they need to live a functioning life. They relearn all the skills they may have forgotten or never had in the first place - how to cook, how to budget, how to sustain healthy relationships. They are encouraged into work or college so they have something to focus on and structure their life around, rather than having nothing to do with their time and fallong back into old habits . The support around them is slowly decreased as they become more independent.
That sort of rehab has a much higher success rate than just putting someone into a 30 day detox or giving them a bedsit. IMO that's where we should be focusing money, on addressing the underlying causes which caused them to become homeless in the first place.