Could I take a Core i7 form a 2012 MBP and put it into a 2018 MBP? I know very little about computer hardware so I thought I might as well ask.

I have an Intel Core i7 in my MacBook Pro Late 2012. I am considering getting a 2018 MacBook Pro. I was wondering if it is possible to purchase an Intel Core i5 2018 model and then just take the 2012 Core i7 and put it in the 2018.

I am wondering if this is realistically possible and also if its technically possible (like could the 2018 hardware accept a 2012 core i7 or would there be other hardware compatibility issues).

I am also wondering how a 2012 Core i7 processor compares to a 2018 Core i5 (would it be worth it).
I don't know what exact CPU model numbers are involved here, but a simple check of the sockets for the ranges shows that the 2011 or 2012 i7 will not fit on a motherboard designed for a 2017 or 2018 i5 (of course Apple may have used a 2010 i7 or a 2016 i5 in their computers, but the same thing would apply).

The later i5 also uses a different I/O bus, but that might be backwards compatible (haven't checked as it's irrelevant since you won't be able to fit the CPU in the first place).

Depending on the exact models involved, the old i7 also would require quite a lot more power than the new i5, meaning higher power draw and heat generation, both problems the new computer case and power supply might not be able to handle.