query posts with selected post ids first

I’m not sure if it’s possible to do this in a single query in WordPress. You could potentially split it into two like below:

<ul>
<?php
global $post;

// Get posts by selected post ids
$args = array(
    'posts_per_page' => -1,
    'post__in'       => [12345,12543],
    'orderby'        => 'post__in'
);
$myposts = get_posts($args);
foreach ($myposts as $post) : setup_postdata($post); ?>
    <li>
    <?php echo get_the_ID(); ?>
    </li>
<?php endforeach;
wp_reset_postdata();

// Get latest posts excluding selected post ids
$args = array(
    'posts_per_page' => -1,
    'exclude'        => [12345,12543]
);

$myposts = get_posts($args);
foreach ($myposts as $post) : setup_postdata($post); ?>
    <li>
    <?php echo get_the_ID(); ?>
    </li>
<?php endforeach;
wp_reset_postdata();
?>
</ul>