Skip to content

alternative for parse_url in magento 2

I want to the parse the URL so I can get the Id from the URL , so I am using the parse_url() function but phpcs says The use of function parse_url() is discouraged ,so is there any alternative for this?

My goal is to get the ID from the string, I have string like http://some.com/demo/id/23/

Thanks,