How to delete a content type, programmatically?
Just make sure that the node type depends on your your module, then Drupal will delete it automatically for you.

See node.type.book.yml in the book module for an example, this is the relevant part:

dependencies:
  enforced:
    module:
      - book


Note that users will have to delete all content of that type before they can uninstall the module then.