Checkerboard square artifacts and crash

My computer crashes often when I try to run any video games. The image attached shows the artifacts that show up when the computer crashes. I'm assuming this is a problem with my graphics card, but it causes my system to completely stop. So, I don't ever see any error messages before I attempt a hard reboot. How do I troubleshoot this problem?

See attached photo. Checkerboard squares of noise.

The only obvious thing left that I can see is the HDMI port. On my desktop case, the HDMI connector won't go all the way in to the port on my graphics card. The port doesn't quite line up with the opening in the case. The HDMI cord seems to make a good connection, though it doesn't go in all the way (about a millimeter short). Could this connection cause my problem?

After a little while running a game, I see square artifacts on my screen and my system crashes. With higher settings on the in-game graphics, this problem happens sooner. I can most reliably reproduce the problem in Kerbal Space Program during the pause menu. Occasionally, it will happen during the loading page of KSP or while I'm browsing YouTube videos, but in these cases, the screen just goes blank.

After one crash, I got a BSoD error. But, this was early on in troubleshooting this problem, and I didn't bother to write down what the error was. After a two of the crashes, I got a Windows notification "Application has been blocked from accessing Graphics hardware." (with reference to KSP_x64.exe)

At first, I assumed that I was pushing my card too hard playing my games on a 4k TV at default-to-high graphics settings. I tried (1) lowering settings in-game, (2) lowering resolution and/or refresh rate in Windows display settings. This only delayed the crash.

I thought the card may be overheating, so I downloaded AMD Link to my phone to watch the performance of my card.

GPU utilization, GPU clock and GPU memory clock all would max out before the crash

GPU VRAM utilization would be around 10-11% for KSP on the 4K television

FPS would be steady at 30 or 60--whatever I had it set to in Windows display settings

GPU TEMP would be about 35C. Not much warmer than it was at startup.

The RX 580 isn't exactly designed for 4k, so I bought an appropriate-sized 1920x1080 monitor. Still experience crashes.