Everyone forms their own group of 2 or 3 students. To pass the class, you must find a group. The course staff will not intervene in group assignment.
At most 1 student in the class will need to drop if they are the only one left without a group. The alternative is to forcibly assign that stray student to an existing group, which would disrupt more than 1 student, so it would be worse. In practice, everyone ends up with a group, since the few students who came into the class without groups just band together into a group of their own.
Everyone takes responsibility for finding their own groups, which minimizes resentment. If students were instead assigned to groups and someone in their group flakes out or drops the class, then the rest of the group would feel resentful toward the course staff for putting them in this predicament.
If 4 friends want to form their own group, they can easily split into two groups of 2. Nobody gets left out.
Note that larger groups (e.g., with 4 to 6 students) means less work for the course staff, since there are fewer groups to supervise and grade. However, I would rather sacrifice some amount of detail in supervision and grading in exchange for students getting to work in smaller groups. I think that's better for students while still keeping a manageable work load for the course staff.