It's not miners which are holding the tx in their mempool, it's any node connected to the network.
If the first transaction (txid) has been confirmed then any transaction trying to spend any of its inputs will be an invalid transaction and no node will accept it.
If the first transaction is still unconfirmed, there are two scenarios: the transaction is flagged as rbf. In this case if the second transaction is paying higher fee rate then it will replace the first one.
If the first transaction is flagged as final (non-rbf), how it will be processed will depend on the node itself. If the node has the first transaction on its mempool then it will reject the second one for being invalid. If it didn't know about the first transaction existance (which is unlikely) then it will accept it and try to broadcast it to other nodes/miners. The chances of the second transaction being confirmed before the first one are slim.