User accounts vs user IDs: login, lookup, and permissions
Once you've logged in, the numeric user ID of your running programs and system resources determines your programs' ability to access resources and perform operations, such as sending signals to other processes. Textual names are used only by utilities and applications that need to convert between names and numeric IDs.
The root user (user ID 0) has permission to do nearly anything
to files,
regardless of their ownership and permission settings. For more
information, see
File ownership and permissions
in Working with Files.
New shells read the data afresh from /etc/passwd. This may be a problem if a shell script that uses ~username invokes another shell script that also uses this feature: the two scripts would operate on different paths if the home directory information associated with the user name has changed since the first shell looked the information up.