The size of the mempool directly affects transaction confirmation times. When the network is congested, the mempool grows larger, resulting in longer confirmation times. To optimize transaction confirmation times, users can prioritize their transactions or pay higher transaction fees.