WP_Query is the advanced way to get posts, filter posts, and write custom queries.
You can even write a SQL Query in WP_Query request.
Usually query_posts() function enough to filter posts most of the time but sometimes you need to write a more advanced filter that’s where WP_Query comes in.
It works almost same as query_post but a bit different like this;
<?php $query = new WP_Query( array( 'author' => 123 ) ); if ( $query->have_posts() ) { // the_title, the_content stufff } else { // no post found } wp_reset_postdata(); ?>
There are so many parameters and advanced ways to use check the codex -> https://developer.wordpress.org/reference/classes/wp_query/#parameters