you can add the user identifier à the redirection URL with this filter
add_filter("login_redirect", function ($redirect_to, $requested_redirect_to, $user) {
$redirect_to = add_query_arg([
"user_id" => $user->ID,
], $redirect_to);
return $redirect_to;
}, 10, 3);