if you use a dedicated game service then all of this is standard. Like playfab, with photon.
you can store all player data, upgrades, names, teams etcetera. and to validate unique names etc is a standard setting. you can login with all kind of devices as well
if you have no experience with multiplayer (as you indicate) you should def use an existing service. to start to create your own with php/firebase etc will be an extreme overkill
but yea, you will need to invest a few dollars