Use [man]parse_url/man and [man]basename/man.
$url = 'http://www.example.com/product-cat/some-kind-of-product/ID-515-M-MAR.htm';
$url_parts = parse_url($url);
$filename = basename($url['path']);
Now it depends on the format of the filename. If the value you want is the second when the name is split by the dashes, you can use:
$filename_parts = explode('-', $filename);
// now $filename_parts[1] can be used