"command not found" means it isn't in your PATH.
If you sudo/su to another user you can be invoking commands that are changing your environment variables including PATH.
PATH variable includes all the directories to look in for executable commands. Each directory is separated by colon (
from the next.
Type "echo $PATH" and you'll see what is in your path.
PATH is typically set initially by /etc/profile and/or /etc/bashrc and then often added to by $HOME/.profile and/or $HOME/.bashrc. It can also be modified by any script or config file executed or sourced by any of those files.
You can see where files are by typing "which <command>" for any command you want to execute (e.g. "which startx"). This will show you which, if any, directories from your PATH contain the command. If none do it will tell you not found in each of those directories.
Note that doing "su -" tells su to invoke the config files for the user you are switchting to (with no user specified you're doing su to root by default) so you might want to look in the target user's $HOME.
HOME by the way is the home directory of the user. echo $HOME will show you what that is after you login or switch user.