Evolutionarily speaking, it seems likely that depression/anxiety are there for some purpose, and yet we treat them both like meaningless pain meant only to be banished using drugs. I believe both are signals that something in our environment is not working for us. They indicate emotional or physical needs unmet---needs for safety, autonomy, connection, etc.
Often the individual suffering is fundamentally unaware of their own circumstances. I didn't realize how messed up my family relationships were growing up until much later. There are various reasons for this unawareness, but I believe the depression/anxiety are there to force our conscious self and the people around us to acknowledge that something is wrong.
This isn't just the old nonsense about depressed people needing to cheer up, and that it will pass in a day. This is a completely different paradigm that explains depression and anxiety as meaningful signals of underlying problems rather than as inexplicable suffering to be numbed through prescription medication. I believe it will prove the more robust and also the wiser way of looking at these experiences.