How network (either gNB/or Core) assigns UEs to sub-groups?

Hi All.

How network (either gNB/or Core) assigns UEs to sub-groups?

I want to understand what criteria are used.