Redirect specific page in WordPress for first time visit

I would always hook it to template_redirect. Something like this:

add_action( 'template_redirect', 'custom_check_for_redirect' );

function custom_check_for_redirect(){
  global $wp_query; # It could work without this too!
  
  if( is_page( 8219 ) )
    $days_to_expire = 30;

    if (!is_admin() && !isset($_COOKIE['already_visited'])) {
        setcookie('already_visited', true, time() + 86400 * $days_to_expire);
        wp_redirect(home_url('/welkom'), 302);
        exit;
    };

};