How can I link to a user profile by their user ID?

One idea is to put an external ID in the user record and then you could use /by-external/:external_id. The other is to use a webhook to notify your external database if they change their username. Another is to just disable changing usernames. From a quick look at discourse/config/routes.db I don’t see any route that uses the user_id.