We use the user name which is used for login so I assume that also the other calls like \OCP\User::userExists() should resolve the name correctly.