As mysticjuicer said, you can click the "leave" button with the mouse on the post-match score screen (where XP is added up). No match will be found during the countdown on that screen fyi, only after it ends.
In addition, you can leave queue via the "leave game" button that screen's pause menu. The keyboard esc button and PS4 options button get you to that menu.
And just for completeness, if you wait until after the score screen counts down and want to leave the queue, you can do it by mouse clicking on the "cancel search button" that's pretty much always on screen, or by holding the equivalent of the PS4 square button on a controller. Also, every pause menu has a purple button added to it that can cancel the search. And if you try to go to Quick Match again, you can cancel it that way too.