All Bitcoin balances are held in separate uniquely identifiable unspent transaction outputs (utxo). Transaction outputs are uniquely identified by their outpoint which is composed from the identifier of the transaction that created the output and the position in the transaction’s outputs (txid:output_position
).
When you create a transaction, you spend one or more UTXOs and create one or more UTXOs.
In this scenario, it sounds like you have your balance in a single UTXO that is spent by both transactions. Since each transaction output can only be spent once, these two transactions are in conflict. Only one of them can be included in the best chain. Assuming that both transactions have roughly the same transaction weight, miners would prefer the second transaction as the higher feerate would translate to the miner collecting a drastically higher fee. Once the second transaction is confirmed (included in a block), the first transaction would appear invalid to any nodes, because the UTXO consumed by the input is no longer available. If the first transaction is included in a block before the miner sees the second, the second would be invalid.