2 things. It is possible there is a kernel extension installed that is interfering, so you might try either booting into Safe mode, or disabling any 3rd Party kernel extensions (http://EtreCheck.com can help showing what 3rd party kernel extensions are installed on your system)
Or if you have a 15" Macbook Pro, it is possible the discrete graphic GPU chip is failing. This is a very common Macbook Pro problem in a few generations of 15" Macbook Pro. If that is the case, then you could force the 15" Macbook Pro to use the integrated intel GPU with gfxCardStatus. I have a Late 2011 15" Macbook Pro with this problem. While I've re-tasked this Mac to file server duty, gfxCardStatus has allowed me to keep this Mac in service and not freeze and/or panic by forcing it to only use the integrated intel GPU.
gfxCardStatus is a free menu bar application that keeps track of which graphics card your MacBook Pro is using at any given time.
<https://gfx.io/>
You can force a Macbook Pro to use the Integrated intel graphic via gfxCardStatus
.
The above does not work on Sierra and beyond, HOWEVER, this version works on High Sierra:
https://discussions.apple.com/message/32581726#32581726
https://github.com/steveschow/gfxCardStatus/releases/download/v2.4.4i/gfxCardStatus.app.zip