Posts list in custom taxonomy

$term isn’t being set anywhere in your code. You’re putting IDs into $terms_ids, but then in your query you’re using $term->term_id. $term doesn’t exist outside of the foreach. You need to be passing $terms_ids directly into terms:

$terms = get_the_terms( get_the_ID(), 'kosmetyki_dystrybutor'); 
$terms_ids = [];

foreach ( $terms as $term ) {
    $terms_ids[] = $term->term_id;
}

$args = array(
    'post_type' => 'kosmetyki',
    'tax_query' => array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'kosmetyki_dystrybutor',
            'field'    => 'term_id',
            'terms'    => $terms_ids, 
        )
    ),
);

$query = new WP_Query($args);