Financially, usually yes over a full career, though it's worth being clear-eyed that residency pays around $67,000 a year while your loan balance sits untouched and accruing. Personally, it's only worth it if you actually want the job itself — the grind is long, and prestige doesn't carry anyone through a 3 a.m. admission.
If you've shadowed extensively, done real hands-on clinical work, and still want this after seeing the unglamorous parts, it's worth it. If you're genuinely unsure, a gap year spent in real clinical work is the cheapest and most honest way to find out before committing a decade of your life to the answer.