Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles

I need to redirect logged-in and non-admin users, from page with id 172, to the home of the website. Note that users that are not logged in can actually see the page.

add_action('admin_init', 'xyz');
function xyz() {
    if( is_page( 172 ) ) {
             if( is_user_logged_in() && ! current_user_can('update_core') ) {
        wp_redirect( home_url() );
        exit;
             }
    }   
}

Problem: This code is not working.

Solutions Collecting From Web of "Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles"