Near-Optimal Regret-Queue Length Tradeoff in Online Learning for Two-Sided Markets