PS4 shows glitch screen and shutdown

Hi
Today my PS4 turned off by itself in middle of playing a game
After that I restarted it and it went to check storage but suddenly it showed a glitchy screen (took a picture of it) and turned off
I successfully booted in safe mode and tried to initialize PS4 but same thing happened while it was trying to initialize.

So now I’m stuck

  1. if I try to turned it on normally it goes to check storage message and glitch out and shuts off

2)if I go to safe mode and choose initialize or rebuild database the same thing will happen

3)choosing change resolution successfully takes me to choosing resolution after restart but after choosing any resolution and showing PS4 logo same thing would happen

Edit : I’m trying to upload a picture but forum won’t let me.search “vertical glitch line” on Google image and it’s something like that

Is this a software or hardware problem?