From a dynamic Order Id you can use WC_Order
add_order_note()
method this way:
// If you don't have the WC_Order object (from a dynamic $order_id)
$order = wc_get_order( $order_id );
// The text for the note
$note = __("This is my note's text…");
// Add the note
$order->add_order_note( $note );
Tested and works.