How to get post ID after removing that post?

There’s only one way I can see that you can get the ID after a post is deleted. If you’re using wp_delete_post to delete posts, you add a after_delete_post action hook where you will then do the other stuff that you need to do like the remove of page from sitemap, etc. The hook has the ID and post object as it’s parameter which I think will be enough for what you need for.