Dear Adrian,
That’s a tough question to answer, given that we can’t see the soul.
However, the child, whether it has a fully functional body or not, is still created good by God, as are all of God’s creations (Genesis 1:31). As such, the child, body and soul, is still loved by God, which is the first and most important step in having a spiritual life.
While we may not know how far the child’s spiritual life can develop with an “unfunctional brain”, we can trust that God still holds a deep love for that child, and, as God favours the little souls, who are child-like in trust and innocence, we can believe that the child’s spiritual life, while most likely not formally developed, still holds a connection to God via its innocence.
As for your question about an unfunctional or dead body, an unfunctional body does not prevent a rich spiritual life. For example, St. Teresa of Avila was bed-ridden for a large portion of her life, yet she still grew a rich spiritual life, for prayer involves the interior, not simply the exterior.
As for a dead body, once dead, a soul leaves the body for judgement, either to Heaven/Purgatory for reward, or hell for punishment.
So, in short, an “unfunctional” body/mind does not necessarily prevent one from having a spiritual life.
Hope this helps.
God bless Mary keep!