Apple Pay and Google Pay never store your card number.
When you add a card, your bank and Visa or Mastercard create a token: a stand-in number that works only on that one phone. Each tap adds a one-time code, so a copied payment gets declined.
A hacked shop leaks numbers nobody can use. A lost phone costs you one token, and your plastic card keeps working.
How it works, in plain words, with diagrams:
https://viacheslavpleshkov.com/blog/how-apple-pay-and-google-pay-work