Miners (or mining pools) confirm the transaction by adding it to the block they are solving. The miners get to keep the fees they get for confirming transactions. Therefore, a higher fee on your transaction means it is more likely that a miner will choose to confirm your transaction instead of a transaction from someone else that paid a smaller transaction fee.
However, a miner CANNOT confirm a transaction if the bitcoins used to confirm that transaction aren't confirmed. If you create a second transaction using some of the unconfirmed bitcoins, and pay a higher fee, you will have miners wanting to confirm that second transaction to get that revenue. Since they can't confirm the second transaction while the first transaction is still unconfirmed, they will confirm them both at the same time.
The total fees of the two transactions together generally has to be bigger than what the miner would have gotten by confirming two individual transactions from other people, so that the miner will confirm both your transactions to get the extra revenue.
Since the second (child) transaction is paying the way for the earlier (parent) transaction, this type of fee paying is often called "Child Pays For Parent", or CPFP.
It won't always work quickly, because not all miners and pools have implemented software that looks for these revenue increasing opportunities, but it can be better than just leaving a transaction with an insufficient fee for days or weeks.
Thank u.