To remove the related products section, you can use the code below in your functions.php file.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
And to get the product IDs, you can use WP_query. Have a look here for the same.
I hope this is what you wanted.
Let me know if you have any other questions.