The biggest threat to the world's security is irredentism. Not racism or even communism. If anything is going to set the world on fire, it will be leaders’ desire to acquire new territory—or, more precisely, to re-acquire long lost territory.
The same way the Treaty of Westphalia made respect for sovereignty into the lynchpin of Western diplomatic relations, we must enshrine respect for national borders. If doing so requires a UN of sorts, respect for sovereignty and territorial integrity should be its core values. Not human rights. Not righting injustices. Not uplifting the oppressed. And certainly not equality. Because injustice and oppression---as terrible as they are---will never destroy the world. Given the existence of nukes, wars can. And the vast majority of wars have been fought over land: Wars of philosophy like the French Revolutionary/ Napoleonic Wars and WWI are quite rare. (WWII was, in fact, a war for territory first and foremost despite its origins in WWI and despite the evils of Nazism though I admit it is a complicated case).
But then the question is, how do you enforce it? How do you impose this "World Federalism" while avoiding the exact issues that have plagued American Federalism? Won’t the UN simply steadily accrue power just as the US Federal Government has done? Won’t it encroach upon the very borders and sovereignty it is supposed to protect?
Of course, the power grabs of the US Federal Government have taken roughly 250 years to reach their present state; that is longer than I expect human civilization to last given the existing state of affairs. Hamilton and Madison’s ideas about checks and balances, as well as Constitutional guarantees, did work to some extent---and any UN like institution should incorporate their ideas. However, that is not enough.
As terrible as this answer will seem, as utterly un-Christian and pagan as it may appear, I believe that a Federalist world government is more likely to succeed than a Federalist Republic. It has something working for it the Republic doesn’t: Ethnic and cultural bigotry. Or, in short, racism: Not the racism of domination, which characterized American slavery, but the racism of avoidance and exclusion. People who have some, but not too much, contempt for one another will not want to invade one another---because they will not want to live together. Indeed, it is the very hate that is currently growing between the Russians and Ukrainians, the creation of hatred where there had been love, that will bring peace. Whether racial contempt or cultural contempt is the driver, loathing is something that can stop one country from having designs on the territory of another.
And I am most certainly not arguing for racial or ethnic hatred within a nation-state. That is absolutely destructive. But between nation states, between different cultures, it can be very useful. Just think how much better the world would be if all the Chinese and Taiwanese hated each other? If Russians loathed all Ukrainians—not so much as to want to remove them but just enough to not want to incorporate them into their Federation? Antipathy can create respect for another’s independence.
A stalker stops pursuing a girl once he is no longer in love with her: In their situation, love is the problem. When love is the problem, loathing can be the answer.
If we are to have peace, we must give hate a chance.