You only register example.com
Once you register a domain then you can create what is known as a sub domain. A sub domain is created by creating records in your DNS.
Usually www.example.com and example.com point to the same place to avoid confusion with people.
You will see many sites that have other subdomains as well.
things like:
help.example.com
secure.example.com
canada.example.com
These can all point to different sites, but you only need register the example.com domain once.