Facebook's search algorithm and privacy settings are continually evolving, and there could be various reasons why your ex might be able to see that you searched for them on Facebook, even if you're not friends anymore. Here are some possibilities:
Mutual friends: If you and your ex have mutual friends on Facebook, your search activity might be visible to them. When you search for someone on Facebook, your activity can show up in their "People You May Know" suggestions or in their search history if they're using the same search query.
Tagged posts and comments: If you and your ex were previously tagged in each other's posts or comments, your search activity could be visible to them through the posts' history.
Public search settings: Facebook has privacy settings that allow users to control who can see their search activity. If your ex has configured their settings to allow friends of friends or everyone to see their search history, it's possible they could see that you searched for them.
Suggested friends: Facebook's algorithm might suggest you as a friend to your ex based on various factors, including your shared connections, interests, or other data points. If your ex receives a friend suggestion based on your search, they could infer that you searched for them.
Data leaks or breaches: Although Facebook takes user privacy seriously, there have been instances of data leaks or breaches in the past. If your search activity became publicly accessible due to such an incident, your ex might have come across it.
Coincidence: It's possible that your ex found out about your search through means unrelated to Facebook's platform. People often talk, and information can spread through various channels.
It's important to remember that technology platforms and their features change over time, so it's a good idea to review Facebook's privacy settings and search options to understand what information is visible to others. Additionally, exercising caution and respecting each other's privacy after a breakup can help avoid unnecessary complications.