Parse URL to get a parameter

I have tried this but it is not working for me. The URL I am passing is https://abc.com/pSubDestination/31?ID=31

let myQuery = wixLocation.query;
var destId = myQuery.ID.toString();

Someone please help. And yes this is a dynamic page