In short, no. Having www. in your domain name is not necessary, and your website be served just fine without it. That being said, it’s in your site’s best interest to ensure that your domain works with or without it.
For More Information Please Refer: https://www.hover.com/blog/do-i-need-www-in-my-url/