Firstly, you should use a dual-channel kit wherever possible. That goes for both DDR4 and DDR5 systems. This will ensure you're getting the most out of the best CPUs for gaming.
For an Intel system, a good kit around the DDR5-5200 range will be fine, while for a high-end system, you'll want something a little faster at DDR5-6000 or even DDR5-6400, if you really want to get every last drop of performance. If you're using DDR4, then DDR4-3200 or DDR4-3600 is the ideal choice; DDR4-4000 is pretty expensive and generally not worth the money.
The sweet spot for AMD's latest CPUs is DDR5-6000. You can go faster but you'll end up paying a lot more money for a very small gain in performance. With AM4 gaming PCs, a decent DDR4-3200 or DDR4-3600 is all you'll need.