Using menu_position to add two entries between Dashboard and Posts

The order of the menu items can be changed using the filter menu_order

add_filter( 'menu_order', 'se354759_menu_order' );
add_filter( 'custom_menu_order', '__return_true' );

function se354759_menu_order ($menu_order)
{
    $cpts = [
        'edit.php?post_type=" . "custom-post-type', 
        'edit.php?post_type=" . "another-cpt'
    ];
    //
    // remove and save first item ("dashboard") in variable
    $first_item = array_shift( $menu_order );
    foreach( $cpts as $ctp )
    {
        $idx = array_search( $ctp, $menu_order );
        if ( $idx === false )
            continue;
        //
        // remove CPT menu item from array
        unset( $menu_order[$idx] );
        //
        // add CPT item to the beginning of the array
        array_unshift( $menu_order, $ctp );
    }
    //
    // re-add "dashboard" item
    array_unshift( $menu_order, $first_item );

    return $menu_order;
}