So you're a 5E DM, and you've been suffering many of the problems that that edition suffers at high level? Are combats a hit point slog? Do they take too long? Are players spending more time designing alternate PCs because they're bored with the ones they have? Is it too hard to balance combat encounters or design challenging adventures because of oodles of hit points and so many spells/powers?
What to do?
Well, sit back and let me try to share some advice. It may not all be good advice, and some of it will definitely not be easy, but don't give up hope!
If you're a 5E (or probably any other more recent edition) D&D DM who isn't yet at the high level of your campaign but want to keep it going at that level, this will be much easier for you.
The trick to building a long-lasting campaign that can handle high level play is to build up complexity into your game world as you go. Don't just focus on the "story" of this group of heroes. Also don't assume they're by default heroes, but that's a post for another day. You need to world build.
It's fairly easy to grab a map you like off the internet, or even to make your own. You could also use a published adventure setting like Forgotten Realms or Greyhawk or Golarion. Now, you need to start filling in ideas about what is, could, or will be going on in those towns and kingdoms and monster-infested waters when the PCs aren't there.
No, you don't need to keep track of everything. You don't need to play out the whole world. Take a breath. It's OK. We're gonna get through this.
You do need to have ideas about who's in charge of what, and what the cultures are like in at least a general sense, and what wars might be brewing, and where powerful monsters lair, and where to find mysterious artifacts. And on the smaller scale, who are the power players in the local area? What are their beefs? How can they help or hinder the PCs?
If you have a fleshed out game world, even if it's not completely fleshed out yet, and especially if it's sometimes inconsistent (the real world is after all!), you can leverage those elements to provide challenges for your players besides yet another quest to yet another dungeon to slay yet another set of 3-4 balanced encounters of monsters/traps, then a boss fight.
Here's the trick though, and why it's easier if you're not yet at high level. You don't need all of this to start. You build it up little by little, and layer complexity and detail onto the game world as you play.
I mentioned in the comments of my last post that I haven't actually run a high level game since I was in high school. And mostly that is because of two things: living the expat life where gamers to play with come and go often, and my own gamer ADHD due to having too many game systems or campaign styles that I'd like to run. With my current game, I'm committed to running it as long as I can, and getting it up into the high levels. I think I'll go into detail in a future post (or posts) on what I remember doing back in high school (lots of PCs were in the level 20s/attack ranks, a few made it into the 30s), as well as what I'm doing now to lay the foundations of long term play in my current campaign (highest PC currently is 4th level).
For now, though, I'll say this. Pay attention to the game world. Have recurring NPCs and villains. Have at least some idea of the region's politics, even if it's all background and never effects play at low levels. Work on multiple factions/power centers/sides that the PCs may join or oppose (or even ignore), rather than focusing a grand narrative around defeating some Voldemort style baddie. Take notes on what the PCs have been doing, and how it may affect these powers that be. Every now and then, throw in agents of those powers. Have them notice what is happening with the PCs. When they get enough fame and fortune (upper mid levels is a good place for this), have them start getting recruitment offers or else people sent to actively oppose the PCs' efforts. Have townspeople recognize them when they introduce themselves by name, or even have them known by their appearance. If the PCs are antagonizing some power center, have wanted posters or bounty hunters show up. If the PCs are aiding a power source, have offers of aid arrive occasionally.
Build up some detail in your game world over time. It doesn't have to be fully fleshed out yet. But it should be reactive to what the PCs are doing. Don't just have "town" be like in a video game, where every NPC has one line of dialogue, and the town simply exists as a place to buy/sell, heal, and rest up. Make the setting a character. Build it up as you go. Keep taking notes. Use those notes to make the game world richer in future sessions.
If you build it up enough, by the time the PCs are high level, the offers of guild memberships, knighthoods, offers to be kept on retainer as a court wizard, etc. will help give them goals and make the players want to invest in the setting as well. And once they're invested, there will be more to do at high level than rinse-and-repeat dungeon raids and hit point slog combats.