Custom query to filter posts that have current post as a taxonomy [closed]

I made it through! I’ll share how I did in case some other person lacking the php knowledge like me lands in the same spot.

add_action('elementor_pro/posts/query/projects_designs_query', function($query)
{

$post_id = get_the_ID();

$meta_query[] = [
            'post_type' => 'designs',
            'taxonomy' => 'projects',
            'value' => $post_id,
            'compare' => 'in',
];
$query->set( 'meta_query', $meta_query );
} );

What this achieves is firstly getting the ID of the current post in the loop (which in my case is a Project custom post type). Then it gets all the post (with custom post type Design) that belong to the same project (the current post).