magento2.4.1 – How to pass the value from Module A phtml file to Module B php file

I want to share one field from Module A to Module B,

I am trying, (Module B)

    $storeid = '"<?php
            echo $this->getLayout()->createBlock("ZeroStorelocatorBlockNeareststore")->setTemplate("Zero_Storelocator::google_reviews.phtml")->toHtml();

    $url = ''.$accountId.'/locations/'.$storeid.'/reviews';

Logic: I want to get location id based on the store code, store code i am getting from Module A pass to Module B in URL 1 and get location ID using API and pass that location Id to second url

The first step, How to pass my Module A phtml file value to Module B php file,

Any best practice pls suggest?