I want to create pagination for my custom post type archive that i am displaying with loop

You Can try this way:
add the following before $args

        if( get_query_var( 'paged' ) ):
            $my_page = get_query_var( 'paged' );
        else:
            if( get_query_var( 'page' ) ):
                $my_page = get_query_var( 'page' );
        else:
                $my_page = 1;
        endif;
        $paged = $my_page;

Replace pagination code with this(make sure to add this after endwhile):

$total = $projects->found_posts;
            $page = isset( $_GET['page'] ) ? abs( (int) $_GET['page'] ) : 1;
            $format="page/%#%/";
            $current_page = max(1, $paged);
            $big = 999999999;
            echo paginate_links( array(
                'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
                'format' => '?page=%#%',
                'end_size'           => 1,
                'mid_size'           => 2,
                'prev_next'          => True,
                'prev_text'          => 'prev',
                'next_text'          => 'next',
                'type'               => 'plain',
                'add_args'           => False,
                'add_fragment'       => '',
                'before_page_number' => '',
                'after_page_number'  => '',
                'total' => ceil($total / $posts_per_page),
                'current' => $current_page,
            ));