Suppose we are talking about conventional war only. In that case, everyone on Earth will suffer economically for a few years, before the recovery completes, and the world ushers in an unprecedented level of development never seen so far under Chinese leadership. The current economic system is becoming dysfunctional, paralyzed by the Western exploitative economic model, especially now in terms of exported inflation, no one grows in the slightest anymore, and it's questionable if there was even ever any qualitative growth in the Global South in recent decades, or if it was just all quantitative growth and global elites getting richer. In that case, the only loser of the US defeat, at the hands of China, would be the West, which would probably fragment and revert back to its natural historical mean (before colonialism). It also implies that China profits most.
A war could result in a lot more than a few years of economic disruption.
And at a minimum, I think we'd be looking at a global depression.
---
The West is less than 15% of global population. Of that, the US only accounts for 4% of global population.
So given the Global South accounts for 85% of global population, in the long-term, China can afford to ignore or bypass the US as much as it can.
It has been very clear than the existing system in the US and Europe hasn't worked for decades now, where incomes for the bottom 50% have fallen or stagnated, whilst all the economic gains have flowed to the top. It's why populists are on the rise in the West.
As per Steve Hsu's recent podcast, the Chinese consensus is that China needs to help manage US decline and not get into a war.
And as for Chinese leadership, China isn't really yet in a position to offer overall leadership.
But at the same time, no-one trusts the USA anymore, particularly given the events since Trump's return.