1/ How we found the issue reason -> https://prnt.sc/M9y42BouzdrH
2/ When we deactivated that plugin – search started to work -> https://prnt.sc/pDthVTxTVZTD
3/ We found that this custom code was the main issue -> https://prnt.sc/Pyijd07H1HE0
4/ We improved your code to make it works without errors and also it is minimazed now -> https://prnt.sc/i3VE5mORS71W
You may read articles about wordpress filters/actions to know how to use them correctly
https://developer.wordpress.org/reference/functions/apply_filters/
https://developer.wordpress.org/plugins/hooks/filters/
https://developer.wordpress.org/reference/functions/do_action/
https://developer.wordpress.org/reference/functions/add_action/
Regards