Where in code to replace content before display of page?

If you use native editor (and not some PageBuilder that stores data in its way), then you should be able to use the_content filter to do that:

add_filter( 'the_content', 'my_the_content_filter' );
function my_the_content_filter( $content ) {

    $content = str_replace(...);

    return $content;
}

You might put some conditions in there, to check if you modify only pages or only on single page and so on…