Android ID Function

Hello, I would like to use the Android ID for my app. Since Android 8, each app has been assigned its own Android ID. What other apps use this ID for? To recognize a device again? How secure is this ID against manipulation? Can other apps access this ID? I was just playing with this feature and if I create an app that only shows the ID and then install it twice (with different package names) I get the same ID. That shouldn’t be right? The Companion shows a different ID and other apps that only show the ID also show a different ID. So as it should be. Why doesn’t this work when installing with different package names?