First of all, it's good that you have an understanding that your friend is only triggering your depression and anxiety and not directly causing it. It is good that you are able to differentiate this. With this understanding , you can work on identifying your friend's actions , behaviours or even speech which triggers you off. From there , you can retrace why,how, when these triggers sets you off. When you settle your old unresolved issues then you can reboot your old thought pattern. Look at your friend as who she or he is. This friend is not similar to someone in your past. Avoid labeling, grouping or categorizing your friend with people you have met and left a negative impact on you. Be aware of your perception.