Querying another post category to match current post and display in loop

if you are adding the custom query into the single template, try working with get_the_category() to get the cat_id for your query;
also, get_posts() does not work with if( have_posts() ) etc.

example code, using a custom query:

   <?php 
   $cat = get_the_category();

   $cat_id = $cat[0]->term_ID; 

   $cpt_match_query = new WP_Query( array(
         'posts_per_page' => 2, 
         'post_type' => 'team', 
         'cat' => $cat_id) ); 

  if ( $cpt_match_query->have_posts() ) : 
    while ( $cpt_match_query->have_posts() ) : 
    $cpt_match_query->the_post(); 
  ?>

    YOUR OUTPUT SECTION

  <?php 
    endwhile;
  endif; 
  wp_reset_postdata();
  ?>

the above does not take care of the html tags in your code, which also need to be readjusted.