Zend certified PHP/Magento developer

How to conditional show content by customer group

I have a function to get the customer group ID and in my phtml file if it equals the customer group id I show content. The issue is that when I test it in a production environment the content doesn’t seem to show but on a development environment it does. I thought pages were built by Customer Group

app/code/{vendor}/{module}/Block/{file}.php

public function __construct(
    ...
    MagentoCustomerModelSession $customerSession
    ...
) {
   ...
    $this->_customerSession = $customerSession;
   ...
}

public function getGroupId()
{
    if($this->_customerSession->isLoggedIn()){
        return $this->_customerSession->getCustomer()->getGroupId();
    }

    return '';
}

app/design/frontend/{Vendor}/{Theme}/{module}/{template}/{file}.phtml

     < ?php if($block->getGroupId() == 1): ?>
        

content messaging

< ?php endif; ?>