linux – How to change UID, GID of user accounts while migrating from one server to another server Centos 7

I have a mail server with 1000 users. I want to migrate the server to the Centos 7 server.

Scenario 1 (old server): UID user accounts start with 501

Scenario 2 (New Centos 7 server): the user account starts with 1001 which is defined in /etc/login.defs

Then I can not migrate the user account to my new server. Due to the UID mismatch

How can I migrate users from the previous servers to my new Centos 7 server that UID starts with 1001?