Apple has never built and will never need to build a competitive search engine, because it owns the devices on which search happens, and thus can charge Google for the privilege of making the best search engine the default on Apple devices. This is the advantage of owning the device layer, and it is such an advantageous position that Apple can derive billions of dollars of profit at essentially zero cost.
A similar type of partnership with OpenAI will probably not be as profitable as search was; my guess is that Apple will be paying OpenAI, instead of the other way around, but the most important takeaway in terms of Apple’s competitive position is that they will, once again, have what is regarded as the best chatbot on their devices without having to make astronomical investments in technology and infrastructure. Moreover, this dampens the threat of OpenAI building their own device that usurps the iPhone: why would you want to buy a device that lacks the iPhone ecosystem when you can get the same level of capability on the iPhone you already have, along with all of the other aspects of the iPhone platform I noted above?