The gap risk runs in both directions. Buy first without a firm sale and you can end up carrying two mortgages, insurance and utility bills at once. Sell first without a lined-up purchase and you can end up needing temporary housing while you find the next place.
A possession date negotiated a few weeks out, rather than the standard 30 to 60 days, buys room to search without a second move, and some sellers add a short rent-back so they stay in the home briefly after closing while they finalize the next purchase. CMHC's lending guidelines also allow bridge financing in some cases, covering the gap between the two closings for a cost.
Joel Dyck sequences this around your actual numbers rather than a default order, so the two transactions line up instead of colliding. Get your hand-reviewed valuation from Joel Dyck.