Rewrite Page Parameters

If city belongs to the page post type, then your rule should either be:

add_rewrite_rule(
    '^city/([^/]*)/?',
    'index.php?pagename=city&id=$matches[1]',
    'top'
);

or:

add_rewrite_rule(
    '^city/([^/]*)/?',
    'index.php?page_id=5&id=$matches[1]',
    'top'
);

Using p, the query will assume post type is post, not page.

Also, if your code uses $_GET['id'] to fetch the value, this will no longer work with a rewrite rule. You will need to use get_query_var('id') instead. If you don’t have access to the code, you can set it in an action that fires before the code tries to get that value:

function wpd_set_id() {
    if( false !== get_query_var( 'id', false ) ){
        $_GET['id'] = get_query_var( 'id' );
    }
}
add_action( 'parse_query', 'wpd_set_id' );

I also suggest using a more unique query var than id!