And this is why UBI was supported by right leaning economists like Milton Friedman. If we believe that people in wealthy societies should have a minimal standard of living including basic food, housing and health care then we can provide it through the market in the form of a basic income
It will avoid the perverse incentives that lead people to get costly health care in the ER (which is then covered by other patients) instead of having health insurance and receiving preventative care
It can prevent people from avoiding getting a higher income lest they start earning too much to qualify for the social programs they depend on
No UBI won't fix all problems - but it may very well pay for itself through better externalities