This should find an immediate parent for you.
// get the current category ID
$category_id = get_the_category(get_the_ID());
// get the current category object
$child = get_category($category_id[0]->term_id);
// get it's parent object
$parent = get_category($child->parent);
var_dump($parent->name . ' - ' . $child->name);
The same but in a WordPress loop:
$args = [
'post_type' => 'post'
];
$query = new WP_Query($args);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
// get the current category ID
$category_id = get_the_category(get_the_ID());
// get the current category object
$child = get_category($category_id[0]->term_id);
// get it's parent object
$parent = get_category($child->parent);
dump(get_the_title() . ': ' . $parent->name . ' - ' . $child->name);
}
}