«حَتَّىٰ إِذَا كُنْتُمْ فِي الْفُلْكِ وَجَرَيْنَ بِهِمْ»
Until, when you are aboard the ships and they sail with them. (Qurʾān 10:22)
«كنتم» addresses the hearers directly, while «بهم» speaks of the same voyagers in the third person. This is the familiar example of second-person to third-person iltifāt.
Maintaining “you” in both places would produce a more uniform address. The shift can instead put the seafaring scene at a narrative distance, as if the event were being shown from another vantage point.
The persons remain related, but the rhetorical camera has changed. That relation—not a random change of grammar—is the point.