Additionally, could anyone go out and chop down some trees and build themselves a house on some unused land?
The Romans, in Rome at least, had a actually quite generous method of social provision. most importantly Nerva created a very generous alimentary scheme to help the poorest romans out. This consisted of tax exemptions (5% inheritance tax) and made generous loans to landlords so that they would help municipalities take care of the needy. Add in the free Grain and Wine, which was enough for a man to live on for a day. Also, if you were below a certain income threshold then you received these benefits regardless, so you could also work odd jobs and make more money on the side.
Water, in Rome at least was never a problem because of the extensive aqueduct system that brought fresh water to the city from the hill and was free for everyone.
Also, everyone except the most rich had patron client relationships. The client helped the patron out on stuff (providing a retinue for important events) and in return every working day (holy days were about 1/3 of all days) a Roman could trot off to his patron and get a small amount of money out of him. A client could have many patrons so he could repeat the ritual perhaps ten times a day and come out with enough money to feed him and his family and other expenses like rent and fuel. It is important to note that almost everyone was a client of someone apart from the Emperor, so this was happening all over the place.
Are you interested in Greece and Rome proper, or are you looking for answers regarding the broader Empire(s)?
As mentioned before patronage was widespread in Rome and Ancient Greece. There is an anecdote about the Greek philosopher Diogenes of Sinope who was himself homeless (he was living inside a barrel):
"The hedonistic philosopher Aristippus won a comfortable sinecure at the court of Dionysius, tyrant of Syracuse. One day, Aristippus observed Diogenes preparing some lentils for a modest meal. "If you would only learn to compliment Dionysius," he remarked, "you wouldn't have to live on lentils." "And if you would only learn to live on lentils," Diogenes retorted, "you wouldn't have to flatter Dionysius.""
So in other words, it was wide accepted that a homeless will receive some kind of help from a patron in exchange for any service he could provide.