get_pages and get_posts returning different data?

You are passing the array for post_status wrong way, Here I updated your code with correction.

To show List of pages

//To display list of pages
$args = array('post_status' => array('drafts', 'publish'));
$pages = get_pages($args);                                                   
foreach ( $pages as $page ) { 
    // some html code that displays the page title 
}

To show List of Posts

// To display list of posts
global $post;
$args2 = array('numberposts' => 50, 'post_status' => array('drafts', 'publish'));
$myposts = get_posts( $args2 );
foreach( $myposts as $post ) {
    setup_postdata($post); 
    //... some HTML code to display the pages
}

Note –

It appears you’ve got confused with terms posts and pages.

  • get_pages() function will return the pages, not the posts
  • get_posts() function will return the posts

error code: 523