The trick to “cancel” a pending Ethereum transaction is to replace it with another one of almost zero ETH value, with higher gas fees, at any other Ethereum address and with the same nonce as the current transaction.
NB: To learn more about the nonce, check the XDEFI Wallet Knowledge Base article about nonces.