It takes some time to get your transaction confirmed in the blockchain. When it gets at least 1 confirmation, the user B will be able to spend the coins. If the transaction never gets confirmed, the transaction will be dropped from the mempool after a few days and the coins will "come back" to user's A wallet, where he will be able to spend them again.
But is it not possible, although rare these days, to receive and use a coin, after the transaction has no confirmations? It is insecure. But I remember some discussions where zero confirmation transactions were still possible.
There is some currency, such as nano, which is based on something similar to that. There is even some exchange that operates BCH like that. Leaving transactions virtually instantaneous. It is very unsafe and risky. Maybe stupid. But it's a possibility.