You can specify an actual time in the locktime field. To cancel the transaction, you spend the input UTXO before the transaction becomes valid.
Any transaction with a locktime into the future will be rejected by the nodes and you have to broadcast your transaction after the locktime.
If the current time (or the current block height) is earlier than the locktime, the transaction hasn't been broadcasted, nodes don't have that in their mempool and there's nothing to be canceled at all.
Nodes have rules about what to do with transactions using the same UTXOs, but I doubt any would not accept a transaction spending a UTXO already seen in a locked transaction.
As I said nodes reject any transaction with a locktime into the futrue. Therefore, they don't keep such transactions in their mempool at all even if they have seen it.