Do to this would require multiple filters.
The first would be by using acf/fields/post_object/query https://www.advancedcustomfields.com/resources/acf-fields-post_object-query/
This filter would need to add another filter on “posts_where” to alter the where portion of the query add searching the post ID, it is very similar to searching custom fields with the WP search. See this for more information https://adambalee.com/search-wordpress-by-custom-fields-without-a-plugin/