esc_html
would be used inside of html for example between a <p>
tag
<p><?php echo esc_html( $some_variable ); ?></p>
esc_attr
would be used for escaping attribute values on html tags like so:
<p my-attribute="<?php echo esc_attr( $some_variable ); ?>"></p>
applying _e
to the end is for using it with text domains and will automatically echo it for you e.g:
<p><?php esc_html_e( $some_variable'some-text', 'text-domain' ); ?></p>
<p my-attribute="<?php esc_attr_e( $some_variable'some-text', 'text-domain' ); ?>"></p>
in addition to _e
there is also __
which does the same as _e
but doesnt echo it so you can store it in a variable.