The ID of the data source is stored in the Repository (PostgreSQL), so if you republish the datasource and override the existing one, the datasource ID will still be the same. (I did a test on my side )
Structure of the URL : https://mytableauserver/#/site/mySiteName/explore/datasource/datasourceID
Also the below articles could also be helpful to confirm the ID didn't change :
- Collect Data with the Tableau Server Repository - Tableau : You can enable the access to the Repository (PostgreSQL), meaning you can run a SQL query on the ID to get the name of the datasource.
- Reference-Tableau Server REST API - Tableau : You can query the datasource via the REST API and get the name in the response
I hope that help! let me know if you have any questions,