As others have explained - sudo allows you to temporarily assume administrative privileges (effectively running your command as root). It's still safer than just logging in as root though - as only the commands you prefix with sudo receive this permission (protecting you against accidentally running something with root permissions because you forgot it was a root shell).
For a home desktop environment, it's typical for most users to be given full sudo access, usually via a group ('admin' in the case of Ubuntu, but it can differ by distribution). A production server environment would likely be configured differently.
Strictly speaking, what a user can use sudo to do is controlled via the /etc/sudoers file - which has a bunch of lines like this:
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
There's a lot of scope here to control which commands can be run if desired. Here's a man page that explains the syntax in more detail: https://www.sudo.ws/man/1.8.15/sudoers.man.html
Each line can constrain what commands can be run by a given user or group (and as which users) - so if you wanted to change who could use sudo, or restrict them you have two options:
- Add or remove them from a group (e.g. Admin) to add or remove the associated sudo privileges.
- Change the sudo privileges for the associated user or group in /etc/sudoers.
For a home setup, I would suggest being careful about how restrictive / complex you make any rules you setup - you are potentially making a lot more work for yourself later if you get too fancy with it.