Question: I would like to add the magento website name to the top header beside the language switcher. 

```
Magento_Store/templates/switch/languages.phtml

```

I can get the id by using, 

```
echo $block->getCurrentWebsiteId();

```

How do I get the website name?

Answer: 
In the current Magento 2.3.X versions (perhaps older as well), the above is definitely not a best practice. Instead, inject the interface `\Magento\Store\Api\WebsiteRepositoryInterface` as a dependency and call upon the repository as follows:

```php
$website = $this->websiteRepository->getById(42);
$website->getName();

```
From your `phtml` you could get the current website name doing something like this:

```
$stores = $block->getStores();
foreach($stores as $store){
    if($store->getCode() == $block->getCurrentStoreCode()){
        $websiteName = $store->getWebsite()->getName();
    }
}

```

So you don't have to change the block.