The use of credit and debit cards are safer than using cash in a digital world because methods for securing digital info, which is ultimately what cards represent, are increasing constantly, where methods of securing hard currency, pre-digital age were and are, much less secure.
Efforts to secure hard currency are older in their development (old as cash itself), than those of securing digital currency, e.g. stronger safes and security methods, special materials added in currency production to stop counterfeiting, marking currency, ink packets in money bags, federally insuring of deposits, etc., on the institutional level.
On the personal level there is education for securely carrying and concealing cash, use of check writing vs. carrying cash (one of the first steps toward eliminating the need to carry and use hard currency), etc.
Though hard currency has the advantage of being physically secured in banks, wallets, etc. anyone who gets their hands on hard currency can spend it without providing any identification proving the money is theirs.
On the other hand, as the digital world moves forward, security methods, like education, stronger encryptions, and biometrics I.D.s, ability to activate and deactivate a card if believed lost or stolen, ability to track credit card purchases/transactions, using pin numbers. The theft of digital data also narrows that number of thieves with the equipment, knowledge and expertise to access, capture, and de-encrypt this data, providing a smaller pool of possible thieves for authorities to pursue than with the theft of cash. Though greater losses are possible through the theft of a credit card, as the thief can charge up to the limit on the card, where with cash the thief is only able to spend until the stolen cash runs out.
Because there is often no record of transactions carried out in hard currency, as there is with digital currency e.g., through entering of pin numbers, making of signatures, swiping your card and gaining card company authorization, the tracking down and apprehending of cash thieves present a greater difficulty for authorities. Potential thieves can get a general idea of how much money one has if they can see the actual currency, where seeing a credit or debit card, gives potential thieves no immediate idea of how much they will get from the theft were they able to access the card. All these security features work together to make digital currency increasing more secure and protected against loss, than using cash money.