Get page id or status by private pages?

Double check you’re using these functions correctly. Try collecting the results and output them in order to see what you’re working with.

get_the_ID() and get_queried_object_id() are two good ways to get the current ID, so pass them to get_post_status().

$debug = array (
    'get_the_ID'                   => get_the_ID(),
    'get_the_ID_status'            => get_post_status( get_the_ID() ),
    'get_queried_object_id'        => get_queried_object_id(),
    'get_queried_object_id_status' => get_post_status( get_queried_object_id() ),
);

// print the results to the screen
echo '<pre>';
var_dump( $debug );
echo '</pre>';

ID of the current item in the WordPress Loop.

if ( get_post_status( get_the_ID() ) == 'private' ) {
    echo ' get_the_ID = private ';
} else {
    echo ' get_the_ID = public ';
}

ID of the current queried object

if ( get_post_status( get_queried_object_id() ) == 'private' ) {
    echo ' get_queried_object_id = private ';
} else {
    echo ' get_queried_object_id = public ';
}

error code: 523