Display result as “prefix+ID” and show in the search result as bookcode

Why don’t you add a custom field to the post, so that when you save the post, you automatically create a custom field with that value, and then it’s easy to search for it and also show on the page.

Save Bookcode as Post Meta

To save that custom field, you can add on your functions.php:

function save_bookcode( $post_id ) {
    // If this is just a revision, no need to save bookcode
    if ( wp_is_post_revision( $post_id ) )
        return;

    // save a custom field 'bookcode' with CFX+ID
    add_post_meta( $post_id, 'bookcode', 'CFX' . $post_id, true );  // true on last param so that this field is unique and saved only the first time
}
add_action( 'save_post', 'save_bookcode' );

In this example, the bookcode is save for any post type, but you can limit to whatever post type you use.

Show Bookcode on template

Then to show on your template, inside the loop, you can just write:

Book ID: <?php echo get_post_meta( get_the_ID(), 'bookcode', true ); ?>

Include Bookcode on search

And to include that custom field on the normal search you can use the pre_get_posts filter:

function add_bookcode_to_search( $query ) {
    if ($query->is_search && !is_admin() ) {
        $query->set( 'meta_query', array(
            array(
                'key' => 'bookcode',
                'value' => $query->query_vars['s'],
                'compare' => 'LIKE'
            )
        ));
    }

    return $query;
}
add_filter( 'pre_get_posts', 'add_bookcode_to_search' );

But this will only return results if you have the bookcode on both title/content and that meta.
If you want instead to add this custom field as one more place to search for something you need to manually change the SQL query:
https://adambalee.com/search-wordpress-by-custom-fields-without-a-plugin/

Or you can also use a plugin that already has that work done like Search Everything or Relenvassi.