The usual way to deal with with-www and without-www URLs it to set
permanent redirects HTTP status 301 in the server header from one type of URL
to the preferred one.
You can see what is the best type of URL (with-www or without-www) for your site
by looking at what type of links you have and what
are the most important URLs of your site indexed in a stable way in search results.
You can see if you have indexed in search results URLs with or without www
by doing searches for example like