When creating a lobby, you can specify if the lobby is either public or private in the options by setting the IsPrivate boolean value. Public lobbies will show up in queries and can be joined by other players, while private lobbies do not show up in queries and require a lobby code.
Both public and private lobbies return lobby codes upon lobby creation and are stored as a members-only lobby property. This code can be shared with other players so they can join the same lobby. Once a player supplies this lobby code to the JoinLobbyByCodeAsync() function, they will be placed inside the lobby. These codes differ from passwords in that the code allows players to locate and join the lobby. Lobby codes are static over the lifetime of the lobby and cannot be changed once created.
For more information, see the documentation for Creating a Lobby and Joining Lobbies.