If you look at the documentation for teh get_avatar() filter, you’ll see that callbacks can accept 6 arguments:
apply_filters( 'get_avatar', string $avatar, mixed $id_or_email, int $size, string $default, string $alt, array $args )
Which means that your callback function is accepting the arguments correctly, including the 6th argument, $args:
function tsm_acf_profile_avatar( $avatar, $id_or_email, $size, $default, $alt ) {
The problem is that $args isn’t being passed into your callback function. This is because add_filter() only passes the number of arguments specified in the last argument, $accepted_args. See the documentation:
$accepted_args
(int) (Optional)
The number of arguments the function accepts. Default value: 1
This is basically a long-winded way of saying that you need to change 5 to 6 in your add_filter() call:
add_filter('get_avatar', 'tsm_acf_profile_avatar', 10, 6);