Change title only in dynamic page

Just to make sure, does the title tag in your <head> area (presumably in header.php) look like this?

<title><?php wp_title(); ?></title>

It has to be like that for Yoast to work with it, and be able to override titles.

Anyway if you add this to your single.php (or at least before get_header() is run for that page) you should be able to modify the page title:

function custom_page_title( $title ){
    $return = $title;

    // You can check what the current post is via $wp_query->post
    global $wp_query;
    if( isset($wp_query->post) ){
        $id = $wp_query->post->ID;
        $post_title = $wp_query->post->post_title;
        // etc

        $return = $post_title;
    }

    // Or just outright change the title
    $return = 'test';

    return $return;
}
add_filter('wp_title', 'custom_page_title', 20);

Another thing to note here is that if you’re using Yoast, you have to make sure that this function runs after Yoast modifies the title, otherwise Yoast will overwrite whatever changes you make. This is where the 20 comes in, as the third parameter in add_filter(). I think Yoast runs its filter at 15, so running yours at 20 (or any number higher than 15) will make sure your filter runs after Yoast’s filter.