This is an odd sentence because "libertarianism" and "socialism" aren't concepts that occupy the same axis.
Let's define terms. That will help.
libertarianism is an idealistic political philosophy. Socialism is an idealistic economic system.
Socialism is an economic system based on public ownership and central planning. Communism is a political system to achieve socialism via class struggle, dictatorship of the proletariat, etc. Democratic Socialism is a political system to achieve socialism gradually via the ballot box.
Capitalism is an economic system based on private enterprise and free markets. Libertarianism is a political philosophy that effectively promotes laissez faire capitalism.
Social Democracy is is a political system that uses some public ownership and / or central planning to mitigate the excesses and shortcomings of private enterprise and free markets. In other words, you wind up with a mixed economy.
Socialism relates to whether various functions are funded by government or private industry. The maximum case is communism I guess, but I think using either label gets muddied because in US culture these words have been co-opted to just mean "BAD" even though huge sectors of our society are government run and run pretty well. There are plenty of reasons to complain about the government here, but compared to places where the government doesn't run such things, we do a lot better
Socialism refers to a centrally planned economy with collective ownership. Having the government step in where the private sector fails does not constitute socialism. That is called a mixed economy or social democracy.
I'm confused by how you use the word "idealistic" about socialism as a concept. Is the fact we collect taxes from everyone and use some of them to pay the cops, teachers, firefighters "idealistic"? Is your assertion that it doesn't work because since the cops are funded by the government, they will do a shitty job compared to if they are privately funded?
Most of the time, the free market run by the private sector does the best job of providing the most goods and services at the best cost. Sometimes not so much, such as education, healthcare, and transportation. Also social services. We also need to protect against predatory practices.
One might argue that if public ownership and central planning works for the fire department; why not nationalize everything? Well, as it is, our mixed economy American food industry produces enough that we could distribute the surplus free to the poor. Socialism would be nationalizing the entire chain of production, from the farm fields to the grocery shelf, and we'd wind up with bread lines.
The idealism is that "from each according to ability, to each according to need", works.
History is littered with cases where things like the military or police were basically private security systems that the wealthy funded for themselves and the rest of the rabble had no such protection. Those countries failed. There are present examples all over the undeveloped world - and it's in large part why those countries are still undeveloped.
That furthers my case for what I call Social Democracy. The private sector and free markets has its place, and indeed should be the default. However, public ownership (I would stress public over government) and central planning have a place. Certainly military and law enforcement to start.