It's not always possible to avoid it, but there are techniques to minimize this problem.
- Good quality lumber that has been well dried is the best start!
- Buy wood closest to needed thickness so you expose less of the core when milling. Usually this is also most economical because thicker boards are a higher price.
- After purchase leave time for the wood to equalize with conditions in your workshop before use. 2-3 weeks, more if possible.
- Quartersawn boards are more stable than flatsawn boards. But more expensive and may have boring grain. Or ugly figure such as in oak!
- Wood with knots is less stable than 'clear' wood. But more expensive and possibly with less character.
- Where you must reduce thickness by a lot, do not plane or sand to final thickness in a single session. Work in stages over some days. If a board distorts a little at one stage the next step can remove it.
- Try to remove an equal amount from each face to equalize core exposure.
- Only mill the wood that you will use immediately.
Where you cannot use milled wood immediately:
- For a short delay, 1-2 days, stack boards with stickers between to prevent uneven water loss.
- For longer delay, up to many weeks, place boards in plastic bags or wrap in plastic to minimize water exchange with air. This also prevents color change from light!
Many such techniques presented with other important tips for new woodworkers in this video from The Wood Whisperer Don't Make These Lumber Mistakes! | Tips for New Woodworkers on YouTube.