I had the same problem on Sonoma 14.5 and the solution that worked for me was to force kill the corespotlightd process and then re-open the system settings app:
https://apple.stackexchange.com/questions/468984/search-in-system-preferences-pane-stopped-working