If you have created a new account, or just logged into your Linux Distribution you may not be able to use the sudo command. This is because the account is not in the sudoers file. I am going to go over how you can add a user to the sudoers file, either by using the usermod command, or by manually editing the sudoers file.
Your post shows root user using sudo, which is not a problem but it is not needed for root to use sudo in this case (root can use sudo however for example to run a php command to work on a website e.g. with Nextcloud occ command like
sudo -u www-data php /var/www/nextcloud/occ user:info myuser
).