In general, about 2/3 of the homeless are transiently homeless. They will be homeless for less than 12 months, they are likely employed while they are homeless at least in a part time capacity, or they are in college. These folks generally refuse to get services and spend their time sleeping in their car, crashing on friends couches, and in a pinch, sleeping in tents outside away from the wild areas. In general, these people are on hard times due to bad luck more or less, and are struggling to get out of it.
Another 1/3 of the homeless are people who used to be in the prior group, but are now "chronically homeless". They may have gotten into drugs or developed a mental issue in the first 12 months that they became homeless. These people are the "out of their minds" camp dwellers we think about when we think about the homeless. The biggest risk factor for being in this group is becoming homeless in the first place, and the best way to prevent people from becoming transiently homeless is to prevent them from losing their stable housing or getting them into stable housing within the first 12 months of them becoming homeless. It is much harder to "rehabilitate" someone who has been homeless for 12+ months than it is to rehabilitate someone who has been homeless for <12 months.
One issue we have now is that is very easy for people to move from "safely housed" to "transiently homeless" and one big way to prevent this downward trend in quality of life is to build more cheap housing so people in the precarious spot have alternatives to living in a tent. Its not going to be an immediate feedback loop but its the only sustainable way to prevent the growing numbers of homeless in US cities.