If you're asking whether that 5Ghz is different than this 5Ghz, the main easy answer IPC (instructions per clock). Unfortunately there are no official IPC numbers, but every new release comes with vague unlabeled slides showing %increase, and then reviewres do their pinning the CPU at a specific clock and measure single-threaded performance to estimate relative IPC improvements (like this https://www.guru3d.com/articles-pages/core-i9-12900k-review,...)
If we go into multi-threaded workloads like compilation, then of course the new one completely throws the 8700k out of the water.
But please don't feel pressured to get on the latest and greatest bandwagon, I'm right here running around with a Thinkpad T460s (with a little bit of a need to upgrade).
_Usually_, if you are not waiting for your computer while CPU is on +90% utilization, there should be little gained from a CPU upgrade. (Workloads that depend heavily on cache size or memory latency are counter-examples)