Hi
If it’s showing it on a external display that would lead us to believe that your gpu is failing but on onboard graphics that’s very very rare
I would ether update it or bring it to a apple store just in case it’s a known software issue
But if we diagnose it and it’s the gpu you will probably have to replace the logicboard as replacing the cpu(gpu is part of it) really isn’t practical for anyone who isn’t doing these sorts of repairs frequently
Hopefully this helps
Any questions please ask
Thanks:-)