how to get an autoincrementing membership id with existing membership numbers
I would use the Contact Identity Extension and add a custom ID type for your membership number (https://github.com/systopia/de.systopia.identitytracker).

Fiddling around with contact ID's in the database could cause strange behaviour of your system because you have to check a lot of tables and changes something goes wrong are quite high.