When I’m reading through emails quickly I often find myself wanting to glance through certain emails really quickly but take my time on others, for example certain newsletters I get I’m not concerned about checking thoroughly while some I am, so when I’m filtering to just my unread emails it can get annoying having them grouped together.
Simply put, add an operator to the search bar like NOT, so if I wanted to find unread emails not from email@example.com I could say is:unread NOT from:firstname.lastname@example.org, for example. Also, grouping in parentheses so you could say is:flagged AND NOT (from:email@example.com OR has:attachment) etc. To implement it you could separate the normal part of the search from the NOT part, and then do the regular search, and apply a filter to the results using the NOT portion.
I was considering moving the emails I want to be more careful with to a separate folder, and I saw that mail rules would allow for something like that, so however the “does not contain” is implemented for mail rules, you could add a search operator that utilizes that function.