How works core.entity_registry

Just a question. How works the core.entity_registry when deleting or changing something in a sensor?
I am asking this because i noticed that when changing or deleting a sensor, it will be added with a progressive _number and not deleted to be ovewritten by the new. So in this way for a sensor i changed three times i have name_of_the_sensor_2, name_of_the_sensor_3 and so on…
Is safe to delete manually the file related to that sensor and restarting HA to have only the correct name?