When bitcoin blocks are full, highest fee transactions are confirmed first.
Pending transactions sit in node mempools awaiting confirmation - can conceptualize mempools as a line to enter a restaurant sorted by who is willing to pay the most.
https://www.discreetlog.com/utxos/