i7 is better than i5. It usually has better clock speeds, depending on the variant. It also has same amount of extra logical cores along with the physical cores depending on the generation, whereas the i5 is only restricted to physical cores.
For eg. the latest i5 8500 comes with 6 cores only, whereas the i7 8700 comes with 6 cores and 12 threads.
Edit: If this is for gamin, the i7 8700k smashes all other CPU, followed by i5 8600k close on its heels.
Which I5, and which I7?
What will the processor be used for?
For multithreaded batch apps, the I7 like the I7-8700K which will have 12 threads will be better.
However, for gaming. an overclockable i5-8600K with 6 fast threads should perform better than a I7-8700 with 12 slower threads.