It's a bit of both. Homeless research identifies two types of homeless: those who are temporarily homeless due to economic or relationship problems, and those who are chronically homeless, usually due to drug abuse or mental illness.
The temporary homeless are the majority of individuals who ever experience homelessness. But the chronic homeless make up the majority of people-days spent in homelessness.
The solutions to help each group need to be different. We can't treat homelessness with a broad brush