First of all let me say that your final test should be to connect an external monitor. If the external display shows the same issue, it's definitely the GPU, if not, it could be an internal connector and could be substituted by a technician.
If it's the GPU... well, unfortunately, GPU cannot be substituted, but it can be repaired by a lab who can do a process called "reflow". The process is expensive (in Italy where I live it's around 250€) and not final since the GPU will break again. Yes, bad news.
For what I understood (I work as a freelance Mac software technician, so electronic is not exactly my topic) the reason behind this issue is that the GPU in your mac has got a faulty component that during the years has deteriorated for the heat, creating micro-fractures in the GPU circuitry. When the Mac is cold those fractures remain dormant but as soon as it heats up, they start to open up and show weird things on your display (and you're lucky, I've seen worse cases: half of the display completely black, Macs rebooting every few minutes, and else)
The reflow process closes those fractures but does not rejuvenate the material which will tend to break again with heat. It could take months, or years if you don't use the Mac every day, but it will break again.
If you decide to repair it, you can make it last longer using a free utility called Macsfan Controller (google it) and set your fans to go faster than the default Apple setting. Also, you should avoid doing on this mac intensive tasks like gaming or video production that could raise the heat level for an extended period of time.
Interesting info, talking with a PC hardware guy I found out that on Windows they had the same problem with Nvidia GPUs during the period 2008-2012. Not surprisingly, this is the GPU brand that Apple mounted in the years that faulty Macs have been produced. I could be wrong but I don't think that after that Apple has ever bought GPUs from Nvidia again.