when you inserting post using $post_id = wp_insert_post( $args ); this function set featured image using attachment ID and post ID.
submit post get image url and pass into this function: $image_id = media_sideload_image( $image_url, $post_id, $image_name ); you will get image id then set into this function: set_post_thumbnail( $post_id, $image_id );