This is why most countries' border services will ask short-term visitors the address of the place they'll be staying while they're there: no country, no matter how open its borders, wants you to visit with the goal of becoming a beggar on their streets.
(And this is also a large part of why particular passports only let you visit particular places without a visa. The EU has internally-open borders for EU citizens, because they have mostly equalized levels of social-welfare "pressure" between countries. But no EU country will let you in from a non-EU developing country that has high levels of homelessness, if you can't prove income; and that's something the EU enforces on its member states, so that no country becomes the de-facto homeless ingress point for the whole of the EU.)
Because of these measures, each country (or open-bordered region of equal-welfare countries) is mostly just dealing with its own homeless problem, not with other countries'/regions' homeless problems.
X% of the population will always need some gov't help and Y% will need gov't help at some point. I think we need to stop negatively viewing these groups as sponges on society. Ability is a spectrum, and we don't criticize someone w Down's Syndrome, and so I don't think we should be so harsh on people who are homeless / have trouble holding down a job / low-ish IQ / and even those who fried their brain w drugs / etc.
Yes, we want to avoid perverse incentives and incentivize people to be productive members of society, but we also need to recognize that some people will always need some help, and as a society, I think we should help them, striving for a future with little to no involuntary poverty.