Hooks are what make it possible to change how WordPress works without editing the WordPress files themselves. WordPress has thousands of them spread throughout its code, and plugins and themes use them to run their own code at the right moment, or to change data before WordPress uses it. There are two kinds of hooks: actions and filters.
An action lets you run your own code at a specific point, like when a post is published or when the header of a page is output. A filter lets you change a value WordPress is about to use, like the title of a post or the number of words in an excerpt. Your code receives the value, and returns it, changed or not.
Many WordPress tweaks are just a single line of code using a hook. This filter, for example, turns off the random post feature added in WordPress 7.2:
add_filter( 'wp_enable_random_content_redirect', '__return_false' );
Code like this can be added to a plugin of your own, a must-use plugin, or the functions.php file of your theme. If you add it to a theme you didn’t make yourself, use a child theme, so your changes aren’t lost when the theme is updated.