Retrieve Store data by code programmatically Magento 2.

You can retrieve the store details by store code using Magento 2.

You required only store code to fetch data of the store. If store code is not valid throws the error,

The store that was requested wasn’t found. Verify the store and try again2.

Useful Interface to get the store data:
Magento\Store\Api\StoreRepositoryInterface

<?php
namespace Jesadiya\GetStore\Model;

use Magento\Store\Api\Data\StoreInterface;
use Magento\Store\Api\StoreRepositoryInterface;
use Magento\Framework\Exception\LocalizedException;

class StoreData
{
    /**
     * @var StoreRepositoryInterface
     */
    private $storeRepository;

    public function __construct(
        StoreRepositoryInterface $storeRepository
    ) {
        $this->storeRepository = $storeRepository;
    }

    /**
     * Get Store list
     *
     * @return StoreInterface|null
     */
    public function getStoreByCode(): ?StoreInterface
    {
        $store = null;
        $storeCode = 'en_us';
        try {
            $store = $this->storeRepository->get($storeCode);
        } catch (Exception $exception) {
            throw new LocalizedException(__($exception->getMessage()));
        }

        return $store;
    }
}

You can get the store data by the foreach loop,

$storeData = $this->getStoreByCode();
foreach ($storeData as $store) {
    echo $store->getCode(); // store code
    echo $store->getName(); // name
    echo "<pre>";print_r($store->getData());
}

Output: Store Data.

Get Store Data Using the store code return the store related data.