It's not clear how much direct democracy is really needed in the 24th century.
Certainly by the 24th century, much of modern day, day to day, bureaucracy will be gone, replaced with computer information systems.
The citizen populace will decide on general policies and guidelines for the government. Direct democracy.
The elected officials and remaining bureaucracy will figure out how to implement these policies and guidelines, and also be there as well to make fast decisions in emergency situations.
I never said there would be no direct democracy, but that it might be contained on particular levels. What if there are only elections to planetary and interplanetary governing bodies, but that other responsibilities and competencies are parceled out by appointments? There are references to mayors and governors, but nothing in those titles requires the positions to be filled by direct elections. In many places, the mayor (or first selectman) is chosen by a vote of a (directly elected) municipal council, not by the direct vote of the residents of the city or town.
The bigger problem that I am trying to enlighten is that there are very few references from the series or the films that tells us anything about how sub-planetary politics work, and that whether or not a given country exists as we know it today depends greatly on how much use there would be for actual politics at that level. Just because there would be federalism between planets doesn't mean that there would be federalism within planets. (The dialogue of Attached suggests that the UFP would be leery of sub-planetary units having too much independence.)
If that were the case, things like USA and UK might only exist if they are useful for administrative purposes, but might have no political existence.
Countries are not simply their governing mechanisms, they are groups of people who have shared common experiences and possess a national identity. A common culture, ethnicity, descent, and history.
So when considering the OP's question of "USA and UK surviving into the Trek era," it isn't solely a question of whether these countries governments will still be there. Will the countriesas
nations still exist?
Nations-states are historically inscribable phenomena. Most are barely a century old (even when the country is older or the notion of the country has been around for some time). There's no guarantee that they will survive, either in this fictional future or in the real world. Moreover, having a common identity does not guarantee that there is a corresponding state for them--even in the current world.
If there were more
evidence of direct democracy at sub-planetary levels, it would suggest that the old nations were more or less still extant, if not necessary. There would exist an arena wherein different priorities between people of one area could be defined against those of another. Instead, there is an incomplete picture of what politics and governance looks like, but I think that it is strongly technocratic. Moreover, I suspect that at least a few people who defined the franchise, Roddenberry among them, felt that resolving scarcity erased all divisions around which conflict might arise, including nations. (There must be a Roddenberry quote out there that says something to this effect, one way or the other.) On the other hand, does the Federation require more democracy than just at the planetary level? Vulcan had a quasi-military ruling group just before the formation of the Federation. And the one place where I might expect that the federation might impose democratic requirements, DS9, appeared to have none: no mayor, no council, just a flimsy comment from Quark about the station's chamber of commerce.