Suchitra has told you the right thing. I would like to add that when changing the lock, change it with a good lock with at least level 2 security for which duplicate keys cannot be made easily, else duplicate keys can be made for any ordinary lock within a matter of minutes, even without making any noise by a clever lock smith.
If living in apartment owned by you, it is not always easy to switch apartment then at least do the following:
1) Install a lock with at least of level 2 security. For details refer: https://www.godrejlocks.com/
2) If possible install multiple locks on main door and also locks in internal doors.
3) If possible avoid follwing a fixed time pattern when leaving or entering house.
4) Avoid answering telephone calls or emails from unknown numbers and email addresses. Change your online identity i.e email id, messenger id etc.
5) Take any other precautions that you think fit as per your circumstances.
If living in a rented house/apartment then do the following:
1) Change the house/apartment at odd hours without making much noise and giving any information to anyone in locality, neighbours etc. as to where is your new residence going to be.
2) Do not transfer your landline phone number or Internet Service Provider to the new apartment. Rather close the account and get a brand new telephone connection and tell the service provider to not list your name, telephone details in publicly available telephone directory either in hard copy or that available online.
3) Do not transfer your cooking gas connection or any similar service/utility to new address, instead close it and get a new one.
4) Distroy the SIM of your mobile phone and get a new SIM from different service provider.
5) Avoid answering telephone calls or emails from unknown numbers and email addresses.
6) Create new email address preferably with gmail as it does not reveal your IP address in the headers of your email, whenever you are responding or writting an email.
6) Do not update the address, phone, email etc. in your present bank/insurance/stock broking etc. account details, if possible close these accounts, instead create a new accounts with a different bank/insurance/stock broker etc.
7) Avoid updating your address etc. in driving license or car registration. If needed get a new driving license from different licensing authourity if you also have alternate residense or address proof. If possible replace your car so that no body can identitify and track you by the car number.
8) Also take all the precautions mentioned(numbers 1 to 4) under category when you "own the apartment."
9) If doing a job somewhere switch the job without leaving any trail at your old job.
10) Take any other precautions that you think, will make impossible or atleast really difficult for any hired private detective/s to track you to your new location from the trail left behind by you in form of above/similar situations/accounts/services/utilities etc.