Where I live housing is provided but some homeless people are so because they trash the apartments or they can't or won't respect very basic rules of not constantly causing a disturbance and the like. Addiction is big part of that. There's lots of programs and services for that too but can't really force people to use those services.
You can do a lot by offering help but some still refuse it. In that case I feel like it's fair to make sure they're not a disturbance to other people just wanting to go about their day.