To get current user info using Apex in Salesforce, call the static methods of the built-in UserInfo class: UserInfo.getUserId() returns the user’s ID, UserInfo.getUserEmail() the email, UserInfo.getProfileId() the profile, and so on. They need no SOQL query, so they don’t count against query limits.
Most tutorials list these methods without showing what they actually return. I ran every UserInfo method in a Salesforce Developer Edition org, so below you’ll see real output, plus the two cases where UserInfo isn’t enough (profile and role names) and the options for flows, formulas and Lightning web components.