Editing the variables in a custom URL

IMHO easiest way to do the trick is use a simple rewrite rule, and demand the logic to the page, e.g.

function my_custom_url() {
  add_rewrite_rule('story/([^/]+)/?','index.php?pagename=story&user=$matches[1]','top');
}    
add_action( 'init', 'my_custom_url' );

After that in page where you need the user id use:

$userqv = get_query_var('user');
$user = is_numerical( $userqv ) ? $userqv : get_user_id( $userqv );

In this way the $user variable will be set to whatever is after the url if it’s a number, and if something not numerical is used in url, it will treated as an username and the user id is get accordingly.