I don't agree with the typical attitude of unconditional rejection of AI, and find it pretty useful overall. But I am skeptical this is a good thing for it to be used for, because a big part of the problem and cause of loneliness and depression is all the ways our society is structurally isolating people and cutting them off from each other's support, which is itself a larger problem than the mental distress it produces. Ways of partially alleviating that distress which cannot result in any sort of human connection (not just AI companions, there are lots of things that do this to varying degrees) I think are ultimately making it worse, because support isn't one-way, if someone is cut off from others, others are also cut off from them.
Your computer is still just your computer, it isn't capable of being your friend, because it isn't a person, even though it's better than a corporation, which isn't a person and also has bad intentions towards people. The best it can do is help you communicate with others.