Yes both cards are the same and you can use it on both PlayStation 4 and 5. Play station Gift cards are not exchangeable or returnable. However if you have any issues with a card you have to contact PlayStation.
I was told to make sure when purchase card it's for your region or there's no way to use it. A friend sold there's online to someone in the region for their card giving them a slight discount.
Each card has its own code on the back of the card. You need to scratch the code on the code and reveal the numbers; these numbers are your code. But you should select the right type of card you are using.