In Matthew 5:23, 24, Jesus is clearly saying that we Christians, must first of all, make sure, that our relationships with other people, are sorted and on a good level spiritually, before we think, of doing anything for God, working for God, serving him in the church, evangelism, worshiping God, or any other service we do for God.
God seems to emphasize the importance of how our relationship is with people, in order to approach and serve him.
We may think that if we spend enough time in prayer and fellowship with God, read his Word the Bible, or do any other work for God enough, then we are pleasing God, and serve him properly.
But if we look at chapter 13 of first Corinthians, we can clearly see, that not matter what things we do, even if we give to the poor to help them, or have the gifts of the Holy Spirit manifested in us, or have great faith in God to do miracles, if we are not patient, if we are full with envy, if we do not forgive but keep records of the wrong things done to us by others, then we are nothing.
The chapter 13 of the first Corinthians, is about our relationship with other people, and Paul says that if we do not have love, and that is love for people, we are nothing.
That is why Jesus said in Matthew 5:24, 25 that we must sort out our relationship with other people first, before we come to God, to serve him, worship him, and do things for the Kingdom of God on earth.
That is why apostle John also said that we can not love God whom we do not see, if we do not love people who we see. And that if we have love for others, God lives in us.
No matter how much time we spend praying and worshiping God, not matter how much we fast, not matter how many passages from the Bible we quote, not matter, we are not close to God, if our relationship to others is not sorted out, and is not in a good shape.
That is why the second command after the first command to love God with all our hearts, minds and strength, is to love our neighbor as we love ourselves. Basically doing to others what we do to ourselves.