Delete Term from Custom Taxonomy using wp_delete_term isn’t working

Finally I get the solution for the code. Thank you my friend @SallyCJ for helping me out.

Here is the code:

add_action( 'publish_program-peduli', 'add_program_term' );
add_action( 'deleted_post', 'delete_program_term');

function add_program_term( $post_ID ) {
    $post = get_post( $post_ID ); // get post object
    wp_insert_term( $post->post_title, 'program' );
}

function delete_program_term($post_ID) {
    $cat = get_post($post_ID);
    if ( ! $cat || 'program-peduli' !== $cat->post_type ) { return; }
    $termslug = $cat->post_name;
    $queryTerm = get_term_by( 'slug', substr($termslug, 0, -9) , 'program');
    $termID = $queryTerm->term_id;
    wp_delete_term($termID, 'program');
}