query_posts -> get page_id from custom field

You get a custom field by using get_post_meta:

<?php $pageID = get_post_meta( get_the_ID(), 'custom_field_name', true ); ?>

You can then use that for the query you need, but you should not use query_posts, this function overrides the main query and isn’t normally used on themes or plugins, it should be avoided. This can increase page loading times and it’s generally better to use WP_Query, get_posts or pre_get_posts action (in case you want to change the main query).

You can also use get_post if you just need to get the page data:

<?php $page = get_post( $pageID ); ?>