The searchAndReplace method allows using the following scopes ($options parameter): document, endnotes, comments, headersAndFooters and footnotes. Headers and footers are set in the same scope, so there's no option to use searchAndReplace only in headers or footers (both scopes are replaced with headersAndFooters).
We have opened a task to be added in a future release of phpdocx.
Please note that a custom development can be done if you need to use searchAndReplace in headers or footers instead of both scopes at the same time. If you are interested on this custom development, you can open a support ticket and send if you are using the classic or the namespaces package; the dev team will generate and send an updated class attached to a ticket reply to allow the requested task (using headers and footers as standalone scopes in the searchAndReplace method).