A gift card is in some ways equivalent to cash. As already stated, if somebody has the numbers on the card they can redeem the value to their account and then use it to buy things. The entire value of the card is transferred to the account and then that value is used to buy things. Some cards can only be used for app, media, and services (e.g., iCloud+) purchases, others can be used in the online Apple Store. They can't be used in a retail Apple Store.
This article explains the different kinds of gift cards Apple uses and has links on how to redeem them and what can be purchased with each kind. Click on the link --> What type of gift card do I have? - https://support.apple.com/HT204199