At first glance, Matthew 5:48 is an overwhelming verse.
Matthew 5:48, "You therefore must be perfect, as your heavenly Father is perfect."
This is an impossible task on our own. Therefore, this verse functions much like the OT law. The reality is that we cannot measure up.
Instead of being discouraged, we can take heart. In 5:48, Jesus is telling us that we need a perfect Savior to take our place in perfectly fulfilling the requirements of the law. We need a perfect substitute. Somewhat ironically, the one doing the teaching in 5:48 is the perfect substitute.
The beauty of the gospel is that Jesus fulfilled the perfection God commands in 5:48. This frees us up to live whole-heartedly for Christ, not trying to earn salvation, but rather enjoying it.