How can I get the content type for which a certain comment belongs?
You can use Comment::getCommentedEntity() to get the entity, and if it's a node, grab the type:

$entity = $comment-&gt;getCommentedEntity();
if ($entity instanceof \Drupal\node\Entity\Node) {
  $type = $entity-&gt;getType();
}