Yes, you can use app_metadata
to store external IDs associated with the user. It is recommended as one of the uses in the docs: Understand How Metadata Works in User Profiles
The app metadata is not automatically exposed to the application in an ID Token, but you can return it to the app by adding a custom claim: How to get user_metadata and app_metadata in id_token - #3 by James.Morrison