Forty is often that turning point in life where the end starts to look closer to the beginning. You have a lot more of your life to look back at and less to look forward to. We joke about mid-life crises, but they're a real thing.
The OP sure sounds to me like they're going through exactly that, and children have become a fixation.
And if they're struggling with anxiety and depression now, I can't imagine what they'd go through as a parent.
At minimum, they should not be making any decisions until they get a little healthier. First, it's very unlikely any decision they take, today, would be rational. And second, if they did choose to become a parent, they'd be doing so at a time when they're incredibly mentally and emotionally fragile, which is a recipe for disaster.