Why it often works, and why that's misleading
Withdrawal keeps most of the semen away from the vagina, and for many couples it works much of the time. That track record is exactly what makes it feel safe. The problem is that it depends on something neither partner can fully see or control.

Gap one: pre-ejaculate
Before orgasm, the penis releases a small amount of clear fluid, pre-ejaculate. Some men produce a lot of it, and it can carry sperm. In those men, pulling out on time can still lead to pregnancy, and there is no way to tell from the outside who they are. Perfect timing doesn't fix a leak that happens before the moment you're timing.
Gap two: infections
Sexually transmitted infections pass through skin contact and body fluids throughout sex, not just at ejaculation. Withdrawal offers no protection against them. Barrier protection matters for all penetrative sex, and especially for anal sex: bacteria from stool can get into the urethra and cause real problems. Use a condom.
What to use instead
A condom covers both gaps. For pregnancy alone, an IUD for the partner is highly effective, and many couples use both: the IUD for pregnancy, the condom for infections until both partners have tested negative and are truly monogamous. When the family is complete, a vasectomy is the most reliable option for the man. See male birth control options and when it makes sense to stop using condoms.
If you're actually trying to conceive
The flip side is also true: if pregnancy hasn't happened despite not using protection, withdrawal or not, that is worth a proper look rather than more guessing. See trying to conceive: timing and the man's side.