linux command found but not found when using sudo

Sudo is not using the same PATH as your current user for security reasons. In /etc/sudoers there is an option secure_path which specifies the path used when running commands with sudo. Mine looks like this:

Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

From the sudo manpage:

 secure_path   Path used for every command run from sudo.  If you don't trust the people running sudo to have a sane PATH environment
               variable you may want to use this.  Another use is if you want to have the “root path” be separate from the “user path”.
               Users in the group specified by the exempt_group option are not affected by secure_path.  This option is not set by
               default.

The pip3 command is probably not in the path defined by the sudoers file. You can either add the path to the secure_path or provide the full path to the pip3 command like this:

sudo /path/to/pip3 install django