How can I make a search term redirect to a page

You could use the template_redirect hook.

https://developer.wordpress.org/reference/hooks/template_redirect/

add_action('template_redirect', 'wpse410342_template_redirect');
function wpse410342_template_redirect() {
    
    if( !is_search() || is_admin() ) 
        return;
    
    global $wp_query;
    
    if( '123456' === $wp_query->get('s') )
        wp_redirect( get_permalink( get_page_by_title('Page Name') ) );
}

Using the page slug instead of name.

wp_redirect( get_permalink( get_page_by_path('page-name') ) );