How to end/escape “Find” command via keyboard in macOS Preview app?
I've found two ways. Both are kind of ugly...
...but first, it's important to note that there are two interface styles for the find action: what you are describing is a mode that is used when the window is rather narrow: a popup at the center of the window asking for the search string.
There's a different mode where the search input is in the toolbar. That mode is used whenever there is enough space in the toolbar.
So, that leads to the first method: make the window wide enough to accommodate the second mode. Because that makes ESC work as expected, and as implied by Marc's incredulous comment.
Here's a second way to do it, in case you are working on a 4:24 aspect ratio portrait mode display, or just feel that preview doesn't deserve those pixels: after entering the find mode, hit COMMAND+E. This will somehow change to the toolbar-style find mode, and you can hit ESC from there.
All tested on Monterey Beta.