Get an array of all users of a custom role type to send an email notification on post update

I think you get the idea to solve it but the code is not correct.
Try this.

// Get practice admin emails
function get_practice_admin_emails() {

    $profile_admin_emails = array();
    $args = array(
        'role'  =>  'profile_admin',
     ); 
    $profile_admins = get_users( $args ); // this must be after $args

    foreach ( $profile_admins as $user ) {
        // try this instead
        $profile_admin_emails[] = $user->user_email;
    }

    return $profile_admin_emails;
}

Explanation:

  • $args must be before get_users( $args ).
  • There was no assignment in this instruction $profile_admin_emails[ $user->user_email ];.