They're not the same thing, despite half the trade using the words interchangeably.
Primer is about adhesion and sealing. It bonds to a difficult surface — bare wood, fresh plaster, MDF, metal, glossy old paintwork — and gives your next coat something to key into. It also seals porous or stained surfaces so they don't drink your topcoat or bleed through it. Different problems need different primers, which is why there's no single "primer" for everything.
Undercoat is about coverage and colour. It's an opaque, high-pigment coat that builds an even base, hides what's underneath, and gets you close to your finish colour so the topcoat goes on cleanly. It doesn't have the bonding power of a primer — it assumes the surface is already sound.
So on bare timber you'd typically prime, then undercoat, then topcoat. On previously painted, sound surfaces you can often skip straight to undercoat (or a couple of coats of a self-undercoating topcoat).
Now the practical bit. Many modern paints have blurred the line. Plenty of premium emulsions and eggshells from Little Greene, Farrow & Ball and Benjamin Moore are self-undercoating on sound surfaces — two coats and you're sorted, no separate undercoat needed. But they are *not* substitutes for a proper primer on a problem surface.
For the primer itself, reach for a specialist: Zinsser BIN (shellac-based) for knots, stains and slick surfaces; Zinsser Cover Stain for water and nicotine stains; a dedicated MDF/wood primer for new joinery. These are tools, not topcoats — use them under your supported-brand finish.
My advice: don't ask "primer or undercoat?" — ask "what's the surface and what's the problem?" Bare or dodgy surface = primer first. Sound surface needing colour build = undercoat (or a self-priming topcoat). Get that right and your finish will look cracking and last for years. Skip the primer on a tricky surface and you'll be repainting peeling paint within a season.