WP_Query: How to get results from both meta_key options?

You can put your meta_query in a variable to achieve the desired result. Then you can fill the variable with your actual meta_query when your condition is met. Check out the code below.

$meta_query = array();

if ( isset($_GET['scope']) && !empty($_GET['scope']) ) {

    $meta_query[] = array(
        'key'     => 'name',
        'value'   => $_GET['scope'],
        'compare' => '='
    );

}

$foo = new WP_Query([
    'post_type' => 'people',
    'posts_per_page' => -1,
    'meta_query' => array(
        $meta_query
    )
]);