Or to use if you do not want to alter the main loop use get_posts. WP query alters the main loop by changing the variables of the global variable $wp_query. get_posts, on the other hand, simply references a new WP_Query object, and therefore does not affect or alter the main loop. It would be used in the same way, but changing $query = new WP_Query( $args ); to something like $query = get_posts( $args );.
If you would like to alter the main query before it is executed, you can hook into it using the function pre_get_posts.