After WWI the League of Nations was established, after WWII the United Nations. The big problems of the 21st century, climate change, overpopulation, resource shortages, can only be solved via more international cooperation.
Same in the fiction history of Trek. No way to get rid of hunger and war (and build starships!) without a world government.
As historically speaking all democratic progressive forces were about centralized rule I see no need to worry about a world government being more in danger of becoming anti-democratic than a local government.