.uk is the country code top-level domain (ccTLD) for the United Kingdom. It was first introduced in July 1985, seven months after the first generic top-level domains such as .com. And it is the second country code after .us.
Although .gb was reserved as the top-level domain for the United Kingdom firstly, .uk was chosen and introduced in July 1985. And .gb has never been widely used and it is no longer possible to register domains under that ccTLD.
Although there are some exceptions like parliament.uk, nls.uk, until 10 June 2014 it was not possible to register a domain name directly under .uk (such as internet.uk); it was only possible as a third-level domain (such as internet.co.uk). Since 2019, it's allowed to register domains directly under .uk TLD.
Currently, the rights to the .uk domain name are owned by Nominet UK. It is possible to directly register a domain name with Nominet UK.
.uk ranks #6 among all domain extensions, and #3 among all country-code extensions (ccTLDs). Currently, there are 10.3M registered .uk domain names. Nominet is the current registry of .uk extension.