WP_Query get posts from custom posts by category

You’re using category query for your custom taxonomy. So it won’t work, because there are no categories with such IDs.

You should use tax_query instead.

// post types query
while ( have_posts() ) {
    the_post();

    // getting the categories
    $categoryIDs = array();  // it's much nicer than concatenated string
    $getcategory = get_the_terms($post->ID, 'custompostnamehere-categories');

    foreach($getcategory as $t) {
        $categoryIDs[] = $t->term_id;
    }

// end of post type query
}
// resetting query isn't needed - you will call your own query next

//starting new query to get related posts within the same categories
$args = array(
    'post_type' => 'custompostnamehere',
    'tax_query' => array(
        array( 
            'taxonomy' => 'yourcustomtaxonomy',
            'field' => 'id',
            'terms' => $categoryIDs
        )
    ),
    'posts_per_page' => 20
);
$q = new WP_Query($args);

// retrieving the data
while( $q->have_posts() ) {
    $q->the_post();
    ...
}