Get category id
Try this in your block file and phtml file
$this->getData("category_id");
In Magento 2 You can get Category Id by using following code
$categoryid = $block->getData('category_id');
I hope this will help
At Block, you can get that parameter value by
if($this->hasData('category_id'))
{
$categoryid = $this->getData('category_id');
}