The Intel Core i5-10400F wins in 5 out of 14 comparable specs, with 7 ties. Its biggest advantage is Threads (100% better).
Core i5-8600K wins in 2 specs (Max Turbo Power: 29% better).
Recommendation
Choose Core i5-10400F if you want the best overall performance — especially threads.
Choose Core i5-8600K if max turbo power matters more to you.