TwoSix
Everyone's literal second-favorite poster
This is excellent and often under-utilized advice. Magic items are a fantastic lever to drive the game in various directions, and fall under complete DM control to modify and place in the game under most tables' social contracts. Give your undertuned PCs straight up potency bumps (+hit, +damage), and give overtuned PCs utility and options.So, you have identified resources that the optimizer uses.
To repeat myself, provide uses for those resources that are not as good as the optimizers uses in the form of magic items or houserules.
Then turn up the game difficulty to match.
One player has PAM+GWM+BM reaction attacks at level 11, to make 5 attacks/round at +10 to damage with their +2 glaive? Neat. That is a lot of damage. The 16 dex ranger dual wielding short swords isn't going to keep up with that.
Flamedancers: This pair of +2 scimitars deals +1d6 fire damage on a hit. When you have both equipped and use two weapon fighting, your bonus action attack lets you attack twice. When you are hit by an attack you can expend a reaction to attack back; if your reaction attack hits, the triggering attack must reroll with disadvantage.
If I did my math right, this still does less damage than the BM PAM GWM fighter does, but it (a) closes the gap, and (b) is really fun.
As the DM you have mechanical levers. They aren't the only things you have, but they are part of your toolkit.
You are in charge of magic items. You are in charge of monster stats.
Part of the DM's job is to use those levers..
Most of the strongest builds in 5e are locked to particular weapon types, so it's pretty easy to give out magic weapons that the strongest PCs won't want. A PAM/GWM fighter or paladin will probably turn down even a vorpal or flametongue longsword.