You can simply use wordpress is_user_logged_in() function with hook woocommerce_thankyou to check the order status and user is logged in or not.
add_action('woocommerce_thankyou', 'my_custom_tracking', 10, 1);
function my_custom_tracking($order_id) {
    if (!$order_id) {
        return;
    }
    // Lets grab the order
    $order = wc_get_order($order_id);
    $_billing_email = get_post_meta($order_id, '_billing_email', true);
    $user = get_user_by('email', $_billing_email);
    //for successful order
    if (in_array($order->status, ['processing', 'completed'])) {
        if (is_user_logged_in() || $user) {
            //it is a returning user
        } else {
            //user is a guest
        }
    }
    //unsuccessful order
    else {
    }
}
Please Note: if you want to check ONLY user is Logged  In or not then replace if (is_user_logged_in() || $user) by if (is_user_logged_in())
Related Question: woocommerce php snippets for proceeded to checkout to know user is login or not
UPDATED v2
add_action('woocommerce_thankyou', 'wh_isReturningCustomer', 10, 1);
function wh_isReturningCustomer($order_id) {
    if (!$order_id) {
        return;
    }
    // Lets grab the order
    //$order = wc_get_order($order_id);
    $_billing_email = get_post_meta($order_id, '_billing_email', true);
    $args = [
        'post_type' => 'shop_order',
        'post__not_in' => [$order_id], //exclude current Order ID from order count
        'post_status' => ['wc-processing', 'wc-completed'],
        'posts_per_page' => -1,
        'meta_query' => [
            'relation' => 'AND',
            [
                'key' => '_billing_email',
                'value' => $_billing_email,
                'compare' => '=',
            ]
        ]
    ];
    $posts = new WP_Query($args);
    if ($posts->post_count) {
        //it is a returning user
    } else {
        //user is a guest
    }
}
Code goes in function.php file of your active child theme (or theme). Or also in any plugin php files.
Code is tested and works.
Hope this helps!