How to display the link (title) and thumbnail post?

The first part of your code is responsible for building the query and getting the related posts. So if this part works OK, you don’t have to change anything in it.

This is the part that is responsible for displaying them:

$query = get_max_related_posts();
if ( $query ) {  // PS. This condition doesn't make any sense it should be $query->have_posts()...

    while ( $query->have_posts() ) {
        $query->the_post();

        echo get_the_title() . '</br>';

    }
    wp_reset_postdata();
}

And as you can see, only titles are echoed in there.

So if you want to display anything more, you’ll have to change this part according to your needs. Here’s an example:

<?php 
    $query = get_max_related_posts();
    if ( $query->have_posts() ) :
?>
<ul>
    <?php while ( $query->have_posts() ) : $query->the_post(); ?>
    <li>
        <a href="https://wordpress.stackexchange.com/questions/328989/<?php the_permalink(); // <- this shows the url to the post ?>">
            <?php the_post_thumbnail( 'post-thumbnail' ); // <- this shows the thumbnail ?>
            <?php the_title(); // <- this shows the title ?>
        </a>
    </li>
    <?php endwhile; wp_reset_postdata(); ?>
</ul>
<?php endif; ?>