Socialism didn't fail because of a UBI, which it never attempted; it failed because it couldn't calculate prices accurately, because it was bad at finding and processing information, political economy, and deeper computational complexity reasons.
UBIs don't have these problems (or, rather, they'd have some of them in different ways, but in ways that are closer to market capitalism than socialism).
That was the trait of planned economy, not socialized ownership of the means of production.
You could theoretically have market socialism, where the only difference from market capitalism would be the lack of distinction between workers and owners. Gig economy would be its kryptonite, though: if allow it you are back to exploiting workers, if you ban it you will also ban a whole lot of actual self-employed professionals.
We don't need theoretical market socialism; we had actual existing Yugoslavia.
Although it functioned better than centrally planned socialism, it still had lots of issues related to prices, particularly of capital. Who provides capital for enterprise? In practice, the state. And this ran into the same political economy issues with centrally planned economies. What happens when a company is about to go under? Unemployment is bad, so the worker-owned company gets a bail out. Who can start a firm? Well, better make sure your company satisfies the objectives of your local government.
I made the socialism-remark because of the post before blaming everything on economic inequality. While that can lead to problems, I don't think it's necessarily a problem in itself or a sign of injustice.
You're correct in that UBI is something different than socialism.
Ironically, I suspect a UBI not only can coexist with inequality but might substantially increase it (not a bad thing in my book). The vast majority of Americans already have incomes above a UBI level, especially when current government benefits are accounted for. But post UBI, a substantial minority would exit entirely from market labor, while another substantial minority would be more willing to take career and entrepreneurial risks that are on average income increasing. There are also some very favorable aspects of it for marginal tax rates, which would encourage workers to earn more income.
UBIs don't have these problems (or, rather, they'd have some of them in different ways, but in ways that are closer to market capitalism than socialism).