You open a project folder, press Command-F, type part of a name, and Finder happily shows matches from your entire Mac. That’s the default scope for searches started in a Finder window, and I find it the wrong choice almost every time. You can change it.
In Finder Settings, under Advanced, the menu When performing a search sets what the search field in Finder windows looks through by default. The choices are your whole Mac, the folder that is open, or the scope you used last time.
Finder > Settings (Command-,) > Advanced
When performing a search: Search the Current Folder
With Search the Current Folder picked, typing “invoice” in a folder like Documents/Taxes only looks there and in the folders inside it.
I’d choose Use the Previous Search Scope if you switch between the two a lot, since Finder then remembers what you last picked. My advice for most people is the current folder, though, because a search you started from inside a folder is almost always about that folder.
The caveat: this changes the search field in Finder windows only. Spotlight from the menu bar or Command-Space keeps searching everything, as it should. Command-F in a Finder window still starts the same kind of Spotlight search, just limited to the scope you picked here.
Further reading: Change Finder settings on Mac (Mac User Guide)