So the other day a friend asked me "What is the difference between the domains mywebsite.com and www.mywebsite.com"?
The differences are mainly technical but important.
The 2 basic differences in very simple terms are relevant to cookies and the ability to change the "destination" that a domain "maps" to in the DNS level.
The core difference for cookies is that a "naked" domain (like mywebsite.com) send the cookies belonging to them to the subdomains they have if the site in the naked domain uses resources from them (or simply requests data from them). As you may understand, this may cause a waste of bandwidth because most of the subdomains (if not all) have no reason to be aware of the cookies of the main site. In contrast, subdomains do not send cookies to other subdomains (unless explicitly stated in the Set-Cookie header of an HTTP response header)
Naked domains can only be associated with "A" DNS records. A records only allow the domain to be associated with a specific IP Address. However, subdomains (like www.mywebsite.com) support "CNAME" records that allow associating a subdomain with another domains or subdomain (such as server2.mywebsite.com). This is very helpful in situations where you may need to manage and move traffic from one server to another (you can do it by simply changing the domains/subdomains that a subdomains "maps" to in the CNAME record).
I hope you find it enlightening and helpful!
If you have any comments Let me know!