Yes, you must buy the correct motherboard for your processor. The most important thing is to check the socket type before purchasing. For example, if you have an AMD CPU, it will either be an AM4 or AM5 socket, and the most recent Intel processors (since 2021) have been LGA 1700 with Alder Lake (12th Gen) and Raptor Lake (13th and 14th Gen). However, if you have an older CPU, then the socket will need to match.