In general, the user ID should be acquired by implementing Firebase authentication in your app which gives you authID that acts as user ID.
For example, consider a chat application that allows users to store a basic profile and contact list. 
A typical user profile is located at a path, such as /users/$uid. 
The user alovelace might have a database entry that looks something like this:
   
   | 
   | 
  
 
  
   
    
 {
   "users": [
     "-MVFliieHpmdMFHzKFim" : {
       "email": "mario@gmail.com",
       "name": "Super Mario"
     }
   ]
 }
    | 
   
  
    
 
  
   
    
 {
   "users": {
     "alovelace": {
       "name": "Ada Lovelace",
       "contacts": { "ghopper": true },
     },
     "ghopper": { ... },
     "eclarke": { ... }
   }
 }
    | 
   
  
    |