The "AI mode" in Google search is pretty bad for programming. It is not Gemini.
I don't have direct experience with ChatGPT but those that do that I've talked to place it behind Gemini and Claude models.
Try free Claude or Gemini on the web and see if you have a better experience. Claude free is better than Gemini free. (actually, Gemini free seems extra dumb lately).