Thank you for asking a question on www.thisisyourbible.com
The context of Matthew 5:48 has nothing to do with perfection and imperfection as we see it but rather it is dealing with the maturity of our relationships with one another. We can either react childishly by responding to negative or beneficent treatment “in kind” or we can be spiritually mature, following the example of our Heavenly Father, and include all in our good will whether or not good will is extended to us by them. Harry Emerson Fosdick in his book "Jesus of Nazareth as His Contemporaries Saw Him", paraphrased the passage which in the KJV reads “be ye therefore perfect even as your Heavenly Father is perfect” as “be ye therefore all-inclusive in your good will, even as your heavenly Father includes all.”
That captures the sense of the passage exactly. Read the context of Matthew 5:48 and you will see how well it fits. Fosdick's paraphrase also precisely fits the meaning of the Greek word for "perfect". The word for “perfect” in Matthew 5:48 is “telios” and means whole, complete, mature.
In 1 Cor. 14:20, Paul says [KJV] Brethren, be not children in understanding: howbeit in malice be ye children, but in understanding be men. The word translated “men” in this verse is also “telios” and has nothing to do with “maleness” but rather in the sense of “be a man!” or “grow up!” Here is the same verse in the ESV:
Brothers, do not be children in your thinking. Be infants in evil, but in your thinking be mature.
Essentially, that is the meaning of Matthew 5:41-48 as well.
God knows us. He doesn’t demand of us what is impossible. “Perfection” will only come the other side of the Kingdom. However, He does want us to do our best. We must keep trying – that’s the important thing. There is only one who was ever perfect and even for him it was an enormous struggle though he had the holy spirit “without measure”.
God does not reject us because we are not “perfect.” In fact, He gave his beloved son as a way for us to deal with our imperfection and then to pick ourselves up and dust ourselves off and continue on our way to the Kingdom secure in His love and forgiveness.
I hope you have found this useful.