A domain is to replace the IP, which is the address of the Internet world, with easy-to-understand words to make it easier to remember.
The part after the last .. of the domain is called the top-level domain (TLD), and you will apply for this TLD when acquiring the domain.
There are various types of TLD such as generic ( gTLD ), country ( ccTLD ), sponsored (sTLD), all of which are managed and operated by ICANN , an organization that controls IP and domains. By updating the domain within 1-10 years (depending on the TLD), the domain usage right will be obtained, and if not updated, it will be returned.
At that time , we may store it at a registrar / reseller who knows the domain and auction or resell the used domain. Since there is only one domain in the world (no duplication) and it is a first-come-first-served basis, it is basically first come first served. (Except for illegal purposes such as selling at a high price)
Therefore, if someone has already used it, you can only get it by another TLD, waiting for expiration, purchasing from the user, etc.