My iPhone XS Max and my iPad continue to connect and disconnect when both devices connect to the USB port of my Macbook Air 2017. However, when I connect non-Apple devices like a wireless mouse, a wired keyboard, a USB port to the USB port of my Macbook Air 2017, these non-Apple devices work perfectly and flawlessly. I'm starting to think that the MacOS Mojave software on the 2017 Macbook Air is in conflict with the iOS 12.2 software on the iPhone XS Max and the iPad.
This problem prevents the iPhone XS Max with the latest iOS 12.2 from connecting to the 2017 Macbook Air with the newest Mac Mojave.
Edit: I've tried to connect the Apple Watch 1 to the USB port of the Macbook Air 2017 and this one is able to perfectly charge the Apple Watch 1. This reinforces my belief that the MacOS software Mojave on the 2017 Macbook Air is not compatible with the iOS 12 on iPhone XS Max and iPad.