has_term not working

You mention in a previous comment that you are defining $post directly before the conditional statements. Since this is the case you need to pass the $post object to both these functions to get desired results otherwise WordPress will attempt to use the global $post object which isn’t what you’ve defined and thus throwing errors or unexpected results.

Parameter three for has_term( $term, $taxonomy, $post ) says:

$post
(integer|object) (optional) Post to check instead of the current post.
Default: null