Gauge is the whole game
Everything else is details; gauge is the contract. The pattern tells you how many stitches and rows per inch — that is the target. Knit a swatch with your candidate yarn and the pattern needle size, wash it the way you will wash the finished object, and measure. If your swatch does not match, change needle size and try again. Yes, it is boring. Yes, it is the difference between a sweater that fits and a sweater that fits only your left arm. The people who skip swatching are the people with bags of half-finished regret.
Fiber content changes everything
A wool yarn and a cotton yarn at the same gauge will behave completely differently — the wool has bounce, the cotton drapes and stretches. Acrylic is a whole third creature that grows when blocked. When you swap fibers, you are changing how the finished piece hangs, stretches, and wears. Rule of thumb: substitute within the same fiber family whenever you can. If the pattern calls for wool, pick another wool. If you must switch families, expect the fit to shift and adjust accordingly — and know that some fibers (like pure cotton for cables) just will not deliver the look the pattern is going for.
The numbers on the label lie a little
The weight category on a yarn label — worsted, DK, fingering — is a starting point, not a guarantee. Two worsted yarns can knit to noticeably different gauges. What you actually care about is the gauge the label suggests and the yardage per skein. Which brings us to the classic disaster: buying the same number of balls as the pattern calls for, without checking yardage. If your substitute has fewer yards per skein, you will run out at the sleeve, and matching dye lots later is a nightmare. Math it out: total yards the pattern needs, divided by your yarn yards per skein, rounded up. Rounding up is not optional.
Dye lots and the curse of the second batch
If you are buying all your yarn now, fine. If you might need more later — sleeves, stripes, that ambitious shawl — buy extra now and keep the labels. Different dye lots of the same color can look like two different colors, and it is fine, it is close enough is how you get a sweater with a visible line across the chest. Also: if you are substituting, swatch in the round if the pattern is knit in the round. Flat swatches lie to circular knitters.
Trust the pattern, then trust your swatch
The pattern designer chose that yarn for a reason, but the designer reason is not your reason. Substitution is about understanding the trade-offs — drape for durability, washability for crispness — and choosing which ones you can live with. If you use Ravelry, it is a goldmine of I made this with X instead notes from real people who already did the experiment.
Swatch, math, buy extra, and swatch again. Your future self, wearing a sweater that actually fits, says you are welcome.