Tracking UID changes upon IP network

We have an Android and iOS platform where we the UID tracking is changing upon IP network change. For example if the user logs on to a WIFI network in the mall and then logs on at home on a different network, the oner user will get tracked twice as two separate UID’s.

Would there be a reason to this happening?

We did think of using a CID to help solve this issue but would like more clarity on using the CID as opposed to the UID to resolve this.