You have to wait for the AI to pit and then hit swap driver again. It's easiest to do if you have "Request Pit Stop" mapped to a button so you can just call them right back in, but if not, you just have to wait it out. Once the AI comes in you have all of the usual settings and choices for a pit stop so just hit swap again and you'll be back in control.