Here is an article explaining ways to remain in spiritual communion with others and Christ when we are restricted from receiving sacramental Communion.

From Archdiocese of Vancouver

There are different models for doing this, but they all have these steps in common:

Make an act of faith: Jesus, I believe that You are really present in the Holy Eucharist. . .

Make an act of love: Jesus, I love You because You are all-good and deserving of my love. . .

Make an act of desire: I want to receive You in Holy Communion, the Gift You have chosen above all others to share Yourself and Your life with me. . .

Invite Jesus to come into your heart: Please come into my heart, my life and everything I do. . .

Thank Him for being truly within your heart and soul

You can simply use these words or expand on them in your own way. Remember to pray for others too, just as you would if you were at Mass and receiving Sacramentally / physically.

Here are a couple of classic versions of a Spiritual Communion:

Spiritual Communion Prayer by Saint Alphonsus Liguori

My Jesus, I believe that You are in the Blessed Sacrament. I love You above all things, and I long for You in my soul. Since I cannot now receive You sacramentally, come at least spiritually into my heart. As though You have already come, I embrace You and unite myself entirely to You; never permit me to be separated from You. Amen.

Saint Josemaria Escriva often taught this version, “I wish, Lord, to receive you with the purity, humility and devotion with which your most holy Mother received you, with the spirit and fervour of the saints.”

St John Vianney said, “If we are deprived of Sacramental Communion, let us replace it, as far as we can, by spiritual communion, which we can make every moment; for we ought to have always a burning desire to receive the good God. Communion is to the soul like blowing a fire that is beginning to go out, but that has still plenty of hot embers; we blow, and the fire burns again. After the reception of the Sacraments, when we feel ourselves slacken in the love of God, let us have recourse at once to spiritual communion. When we cannot go to the church, let us turn towards the tabernacle; no wall can shut us out from the good God.”