Assume we have a $node object and it has some reference field, we get to that field with
$node->get($field)->referencedEntities();
where we get array of entites we can loop now, se lets say this reference field is even paragraph which has another reference field in it which is taxonomy term, we will loop this field like this