how do I include wp_enqueue_style correctly?

you are trying to enqueue stylesheets before wp_enqueue_scripts hook is fired. WordPress recommends registering and enqueuing scripts and styles on the wp_enqueue_scripts hook to ensure they are loaded correctly.

In your functions.php, you are enqueueing the stylesheet preload-style using the wp_enqueue_style function outside the wp_enqueue_scripts action hook, causing the error. To resolve this, you need to move the wp_enqueue_style call inside the wp_enqueue_scripts action hook

add_action('wp_enqueue_scripts', 'wpnoob_enqueue_styles');

function wpnoob_enqueue_styles() {
    wp_enqueue_style('preload-style', get_stylesheet_uri(), false, null);
    add_filter('style_loader_tag', 'wpnoob_preload_filter', 10, 2);
}

function wpnoob_preload_filter($html, $handle) {
    if ($handle === 'preload-style') {
        $html = str_replace("rel="stylesheet"", "rel="preload" as="style"", $html);
    }
    return $html;
}

tech