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.