Saving 'sub' from Identity Provider
The association is stored in openid_connect_authmap and there is a service: openid_connect.authmap to access it.

Without DI:
\Drupal::service('openid_connect.authmap')
  -&gt;getConnectedAccounts(\Drupal::entityTypeManager()-&gt;getStorage('user')-&gt;load($userid))