List of users with email and role

That’s the correct way to get what you need. Though I’m not sure why WordPress returns an array of roles since ( to my knowledge ) you can only have 1 role at a time. Roles being an array you can modify by just retrieving the role index 0:

$blogusers = get_users();
// Array of WP_User objects.
foreach ( $blogusers as $user ) {
    echo '<span>' . esc_html( $user->user_email ) . '</span>';
    echo '<span>' . esc_html( $user->roles[0] ) . '</span>';
}

error code: 523