I haven't been homeless, but the presence of homeless people in the city centre where I work has become huge recently. That said, there are charities and organisations out there to support those people to at least have somewhere warm to stay (assuming they're not involved in anything criminal). I know the 'easiest' thing to say would be 'don't do drugs/crime and you'll get help' but I doubt it's that easy in reality.
You could look out for charities around you and reach out to them for support
Concerning the warm place to stay, if you're talking about shelters, I stayed the heck away from those. They are dangerous places, filled with both addicts and seriously mentally ill people. If you're even able to get a spot in them, you'll have to be careful there. Stuff gets stolen every night, fights, drugs...maybe where you live they have better shelters, but you are actually safer on the streets where I'm from. In Canada, you can't sleep outside most time of the year, you'll die (a miserable death). So you have to find sleep during daylight and warmth so you can stay moving at night.
I would stay up all night, get as much done as I can during the morning and afternoon, and get as much sleep as I could before night comes. It's very hard to do anything productive for yourself with this schedule, but it's how I got by.
The food bank can help you a couple times a month, but they tell you right away, they are not a meal replacement option. They can not afford to keep everyone fed all the time, but they do what they can. If you're smart, you shouldn't go too hungry on the streets, unless you have an addiction. That's a whole different story..
You really have to stay on top of yourself. Everyday has to improve by 1%. Without extreme effort, your life declines very quickly, and it's easy to become trapped..instead of trying to find work and get off the streets, you become accustomed to your lifestyle. Pan handling will be enough to keep you fed. Before you know it, you've given up and you are just...there...when people can tell your homeless, they look at you different...then comes even more depression, likely causing you to turn to booze or drugs if you haven't already.
I've almost fallen victim to the cycle, and I've seen people stuck in it. It's hell on earth.