WordPress hide current blog post from related posts

I have my blog posts set up so that it shows a blog roll of other posts at the bottom. I am trying to hide the current post that the user is on from the other posts as it would not make sense to appear there.

The problem I am having is that it is hiding the first blog post from the blog landing page also. I am using the following code in my functions.php file:

add_action( 'pre_get_posts', function ( $query ) {
    // not an admin page and not the main query
    if ( ! is_admin() && ! $query->is_main_query() ) {
        $query->set( 'post__not_in', array( get_the_ID() ) );
    }
} );