Firestore document IDs must be unique within the same collection. They can be duplicated in other collections or subcollections. You can test this for yourself by manually creating the documents and see that it works OK.
Practically speaking, all automatically generated document IDs will be unique, because they are random, and there is an astronomically low chance of two of them colliding. The client SDK generates ID with 20 characters, each allowing for all lowercase letters, all uppercase letters, and all digits. So there are a total of (26+26+10)^20 = 7.0e35 possible combinations of possible unique IDs. (That's a very large number - 7 with 35 zeroes after it.)