Check if parent page has child page of certain slug

For now I was able to achieve it by adding this to my function:

$slug_to_check = 'my-child-slug';

// go through each child page we found
foreach( $child_pages as $child_page ) {        

    // get the slug of this child page we found
    $child_slug = $child_page->post_name;
  
    // get the link of this child page we found
    $child_link = get_page_link( $child_page->ID );
  
    // if the child page we found has the slug we want
    if($child_slug === $slug_to_check) {
      
        // output the child page link
        $response="Yes, this parent has a child page that we are looking for.";
    
    }  
}