Working in the admin is quite a bit different from the front-end of a WordPress site. Most of the documentation you’ll find online deals solely with the front-end. That can be frustrating when looking for something that should be simple and straightforward.
In this case, I think you would use
get_current_screen(). This returns the screen’s ID, action, base, and other features of the admin page.
From the codex on
This function returns an object that includes the screen’s ID, base,
post type, and taxonomy, among other data points
This doesn’t work everywhere in the admin, so make sure you read the restrictions.