How to Retrieve a Taxonomy Term’s ID?

The term ID is contained within the term object you are already using in your loop:

echo z_taxonomy_image_url( $term->term_id, 'thumbnail' );