I do this via the REST API in Magento 2.3.2. It’s somewhat involved. I follow these steps:
/rest/default/V1/categories?rootCategoryId=1&depth=5
This call gets all categories starting at the root to a depth level of 5 (your root id may be different)
For each category in the list above, I call /rest/default/V1/categories/:categoryId?storeId=1
Where the :categoryId is the id for the current iteration. Your storeId may be different. In the results from this call, check the custom_attributes array where attribute_code value is url_key and if the value matches the URL key you want, you can run the final call to get products by category id using the category id of the current item
The final call would look something like this: /rest/default/V1/categories/:categoryId/products?searchCriteria[page_size]=50
where categoryId is the id you retrieved from step 2
It’s a number of calls, but you can safely cache the results until your next category update, and none of the calls takes long at all