Use WP_Query and then loop the results using break when you want to stop to put the ad.
$args = [
'posts_per_page' => 5
];
$posts = new WP_Query($args);
Then loop 2
<section class="posts">
<?php $cont = 0; ?>
<?php
while( $posts->have_posts() ) : $posts->the_post(); $cont++;
$id = get_the_ID();
//Show your post here
if($cont >= 1) break;
endwhile;
?>
</section>
<div class="ad">
<?php //Show ad ?>
</div>
<?php //Rest of the posts ?>
<section class="posts">
<?php
while( $posts->have_posts() ) : $posts->the_post();
$id = get_the_ID();
//Show your post here
endwhile;
?>
</section>
If you are doing this in a Post or Page you should reset the query after showing the posts:
wp_reset_postdata();