What does it mean for Christ to be in our midst in the setting of Matthew 18:20?
Our heavenly Father loves little children (Mat 18:2,5,10). He rejoices every time a straying sheep is brought home (v13). We should be like Him and try to win back a brother or sister who sins (v15). Our Lord gives us the process to do so (vv15-17). Sadly, believers can pursue restoration in the correct sequence and with the Father’s heart, only to have the erring one refuse to listen. The church must then take the painful step of excluding this person as if he or she were an unbeliever (v17).
This is where verses 18-20 come in. In each verse, there is a parallel (stated or implied) between heaven (recall the Father in heaven) and earth:
What’s bound/loosed on earth … will be bound/loosed in heaven (v18).
What’s prayed for on earth … will be done by the Father in heaven (v19).
Where two or three are [on earth] … Christ will be [despite reigning in heaven] (v20).
This brief contextual work enables us to give the following answers to the questioner: First, doctrinally, Christ’s being in our midst means that He is God. This is implied by the heaven/earth parallels laid out above. Christ can promise His presence to those gathered in His name for the same reason He can promise it to all His disciples for all time (28:20): He is Immanuel, “God with us” (1:23). God is omnipresent (Psa 139), and Christ is omnipresent too, able to be with His people while reigning in heaven as Lord.
Second, practically, Christ’s divine presence means that He is with His people in a special sense to help and comfort us. The Lord’s words assume His omnipresence, but they promise something more. Remember the context: few things can be more painful to a church than excommunicating a member. The situation is so serious (v18) that believers are driven to urgent, united prayer (v19). In their sense of great need, and as they quickly discover the limits of their own wisdom, courage and love, they can find great comfort in the promise that their Father in heaven will grant them the help they ask for, and that Christ’s presence will be with them all the way. It’s as if the Lord is saying: “As you are led by my Spirit in dealing with a straying brother or sister, don’t be discouraged or afraid; my authoritative and comforting presence is there. You are not acting alone, but under and with my authority.” Church discipline is a responsibility every bit as daunting as worldwide mission (28:18-20). As we seek to fulfil both responsibilities for the Lord, and meet in the regular gatherings of the local church, what a comfort it is to know that He is with us.
 Andreas J. Köstenberger, Benjamin L. Merkle, and Robert L. Plummer, Going Deeper with New Testament Greek: An Intermediate Study of the Grammar and Syntax of the New Testament, rev. ed. (Nashville, TN: B&H Academic, 2020), 85.