You will need to install a user script manager extension to install this script.
This user style hides most of the random, unrelated videos which YouTube injects into search results, while still allowing you to access them. It gathers videos from categories like "People also watched" and "For you" and collapses them into thin boxes on-screen so they won't distract from the actual search results. Hover the mouse over these boxes to show their contents (animation of this below). This stylesheet works for YouTube's Light and Dark themes.
A couple unrelated videos will occasionally show up in some search results, but this stylesheet will still significantly reduce the amount of scrolling needed to find what you're searching for.
Below is an example where I searched for "Mickey Mouse". As you can see, the unrelated videos are tucked away in the "For you" and "Previously watched" boxes, which can be expanded by hovering the mouse over them.
April 22, 2023: Now applies to lists of Shorts, which are getting more prevalent as YouTube tries to become TikTok.