url not using query string no longer working

I have a few websites where I have coded a custom feature to get data from the database, these are all older sites. the page fetches info by grabbing the last part of the url and turning it into the variable ‘item’

example.com/item/12345/

this used to work, but now it no longer does. something is stripping off the last part of the url and it’s just loading example.com/item/

The workaround of changing the url to

example.com/item/?item=12345

has ‘fixed’ it but I’d rather the other url. Can anybody shed any light on what has happened here? I believe this happened on a wordpress update a couple of versions ago.