magento2.4 – How to display the cart number on each page?

I am having an issue,How to display the cart number on each page?

$helper = $this->helper('MagentoCheckoutHelperCart');
echo $helper->getItemsCount();

or

$helper = $this->helper('MagentoCheckoutHelperCart::class');
echo $helper->getSummaryCount();

Can only be displayed on the shopping cart page, and still displays 0 on other pages