There are a large number of organisations selling domain names on the Internet. Check the reviews and choose one with good customer service that is offering good value for money. The range of domains names they each sell varies so your requirements might dictate your initial choice, but in most cases, you can move the domain name after a certain amount of time has elapsed.
Once you have the domain name you can use that to set up your email within Microsoft 365 the way you would expect. If you wish, you can also set up a subscription to use a Web Server and establish a web site using your domain name.