How can I save cookies to members

You can can read the cookie and check if the current user is logged in using get_current_user_id(). If they are just save the cookie value to the user_meta.

$cookie_name="";

if( isset( $_COOKIE[$cookie_name] ) ) {
    $user_id = get_current_user_id();

    if( $user_id ) {
        $meta_key = $cookie_name;
        $meta_value = $_COOKIE[$cookie_name];
        update_user_meta( $user_id, $meta_key, $meta_value );
    }
}

error code: 523