Code to show related posts (custom post type and custom taxonomy/category) is messing with other code

It seemed like you did not call wp_reset_postdata() which in short, restores the context of the template tags (e.g. the_title() and get_the_title()) from a secondary query loop back to the main query loop.

More details at

So basically, you just need to call wp_reset_postdata() like so, and then the issue in question would disappear:

echo '</ul>';

// Restores the $post global.

// Now this should show the correct title.
echo '<h2>Más datos de ' . get_the_title($post->ID) . '</h2>';