How to get the customer ID from an order ID in WooCommerce?

I am trying to add customer info to the woocommerce admin order page. When users create their accounts, we store customer info in the user meta. When the customer places an order, I want to show it in the order details. I am using the woocommerce_admin_order_data_after_billing_address hook where I have a $order object; how can I get the customer_id from $order?

add_action( 'woocommerce_admin_order_data_after_billing_address', 'ae_customer_details' , 10, 1 );
function ae_customer_details($order){
    echo "<p><strong>Custom Details:</strong> " . get_user_meta( $user_id, '_custom_details', true ) . "</p><br>";
}

You can get customer ID from $order in many ways.

For WooCommerce 3.0+

// Get the user ID from WC_Order methods
$user_id = $order->get_user_id(); 
// or 
$user_id = $order->get_customer_id();

Before WooCommerce 3.0

$order_id  = $order->get_id();
$user_id = get_post_meta($order_id, '_customer_user', true);