Setting the preferred domain indicates how your site should be crawled and indexed by search engines (such as Google, Bing, Yahoo for example) and how it will be displayed in search results.
This means that you can choose to use the www version of the domain (https://www.yoursite.com) or the non-www version of the domain (https://yoursite.com).
A preferred domain is also the domain that you want your users to be redirected to whether they type in www or not.
It is very important and recommended that you set up a preferred domain on your website.
Regarding the choice of whether or not to use the www, this is a personal choice and not a technical one. There are big brands like Google that use www, and others that don't use like Twitter for example.
To configure a preferred domain, access the SEO Center tab on your Site Manager, then click on Redirect Manager and choose the desired option in the Preferred Domain field:
If you do not set up a preferred domain, it is possible that search engines will end up crawling and indexing the two domains (with www and without www) as if they were two separate domains (even if they are redirected to the same URL at the end).
This means that search engines may understand that there are two different websites but that they are copying each other's content information, and this can cause a severe drop in the website's ranking position in searches (due to sharing the address value) and also content duplication issues.
Also, if your site has the URL available in either www or non-www format, sometimes search engines will crawl and index the domain that you didn't want (non-preferred domain).
If this happens, you may think that your site has not been indexed by search engines when actually the non-preferred URL has been indexed, due to search engines considering the www and the non-www domains as separate web addresses.
To avoid these types of problems we recommend setting up a preferred domain.
The link below (from Google.com) brings more information about preferred domain: