The preferred domain is the one that you would liked used to index your site's pages (canonical domain).
Links may point to your site using both the www and non-www versions of the URL (for instance, http://www.site.com and http://site.com).
The preferred domain is the version that you want used for your site in the search results.
We recommend that you use a server-side 301 redirect
Also you can use rel="canonical" HTTP headers to indicate the canonical URL
for HTML documents and other files.
Explore more about www/non-www versions in this guide
and Google article
Test your site for potential URL canonicalization issues. Canonicalization describes how a site can use slightly different URLs for the same page
(e.g., if http://www.example.com and http://example.com displays the same page but do not resolve to the same URL).
If this happens, search engines may be unsure about which URL is the correct one to index.