Introduction
In the OP's question, there is a great deal to explore. The title and part of the question asks "is 'desire' sinful", but it is readily apparent that the OP is actually asking about a specific type of desire - sexual desire. Thus, in my answer, I will seek to explore:
- Matthew 5:27–28 specifically
- Synonyms for sexual desire
- Classes of usage for sexual and non-sexual desires
- A distinctions and overlaps between sexual desire and "desires of the flesh"
Lust in the Sermon on the Mount
The passage referenced in the OPs question, Matthew 5:27–28, occurs in the context of the Sermon on the Mount. A textual analysis of this passage reveals that Jesus repeatedly uses hyperbolic absurdity as a rhetorical device in his sermon. For example, immediately before this passage, Jesus states in Matthew 5:21-22:
You have heard that it was said to the people long ago, ‘You shall not murder, and anyone who murders will be subject to judgment.’ But I tell you that anyone who is angry with a brother or sister will be subject to judgment. Again, anyone who says to a brother or sister, ‘Raca,’ is answerable to the court. And anyone who says, ‘You fool!’ will be in danger of the fire of hell.
Yet, later in on Matthew Jesus calls the Pharisees and Teachers of the Law "fools" (μωρός/móros) in Matthew 23:17
You blind fools! Which is greater: the gold, or the temple that makes the gold sacred?
In addition to the use of μωρός/móros in Matthew 23, all Christians are called μωρός/móros in 1 Corinthians 4:10:
We are fools for Christ, but you are so wise in Christ! We are weak, but you are strong! You are honored, we are dishonored!
Were we to apply the same standards to Matthew 5:21-22 that we often apply to Matthew 5:27–28, we would be forced to conclude that Paul and Jesus himself were in danger of the fire of hell.
Likewise, we see in Matthew 5:29-30
If your right eye causes you to stumble, gouge it out and throw it away. It is better for you to lose one part of your body than for your whole body to be thrown into hell. And if your right hand causes you to stumble, cut it off and throw it away. It is better for you to lose one part of your body than for your whole body to go into hell.
Another, clearly hyperbolic statement. The point here is not to condemn a specific act, such as homosexuality or lust, but instead to level the playing field. To illustrate that all have sinned and fallen short of the glory of God. To show that the there is no difference in the eyes of God between the pharisee and the laity, the adulterer and fidelis, the angry and the zen, the homosexual and the heterosexual, or the Jew or the Gentile.
Instead we are advised in Matthew 5:48 to
Be perfect, therefore, as your heavenly Father is perfect.
-- A standard which Jesus knows full well is an impossible one.
Clearly, these passages were not meant to be used as dogmatically as they are in modernity as even Jesus himself did not maintain the letter of the law as he lays it out in his sermon. It stands to reason one can have at least some level of lust in their heart or mind and still be free of sin just as Jesus had at least some level of disdain for his brothers; calling them μωρός/móros and yet still lived a sinless life.
Similar desire
Within the New Testament, there are several words which are translated as "lust" or "desire" (or some variant thereof) and these include:
While usage of ὄρεξις and πάθος refer exclusively to sexual sin within New Testament usage, this is not the case in Septuagintal usage. Translations of desire that share a common root of ἐπιθυμ in New Testament writings however, vary widely in scope. For example,
1 Thessalonians 2:17 states:
But, brothers and sisters, when we were orphaned by being separated from you for a short time (in person, not in thought), out of our intense longing we made every effort to see you.
Luke 15:16 also makes use of this root, saying of the prodigal son:
He longed to fill his stomach with the pods that the pigs were eating, but no one gave him anything.
And Romans renders this as "Covet" in 7:7 saying:
What shall we say, then? Is the law sinful? Certainly not! Nevertheless, I would not have known what sin was had it not been for the law. For I would not have known what coveting really was if the law had not said, “You shall not covet.”
In the old Testament usage, the following are sometimes translated as ἐπιθυμία (or variants) in the Septuagint or as "lust" or "desire" and sometimes have a sexual connotation:
Perhaps the most interesting case study however, is Philippians 1:22-26 which reads:
If I am to go on living in the body, this will mean fruitful labor for me. Yet what shall I choose? I do not know! I am torn between the two: I desire to depart and be with Christ, which is better by far; but it is more necessary for you that I remain in the body. Convinced of this, I know that I will remain, and I will continue with all of you for your progress and joy in the faith, so that through my being with you again your boasting in Christ Jesus will abound on account of me.
This is particularly interesting because suicidal ideation could be argued to be a sinful desire, however the author chooses to deny this arguably sinful desire soas to follow a holy edict in a manner similar to the rhetoric around homosexual desire; The desire is sinful, but it's denial is righteous.
Conversely, one can make the case that the desire for death is a holy one in which the author of Philippians desire for death is not sinful, but really a desire to be with the Messiah. Neither the desire, nor the expression of that desire is sinful - very similar to the case that many make for homosexuality.
Classification of Desire
In looking at the usage of words translated as "lust" or "desire" refrenced in the Strong's concordance entries above, in the New Testament, some broad categories of usage emerge:
- Generalized and ambiguous non-sexual "wants" or desires
- Sexual desire1
- Desires of "the flesh"
- Miscellaneous usage
Similarly, In looking at the Old Testament translations and usages of "lust" and "desire" categories of usage emerge as:
- Desire for money
- Desire for food
- Sexual desire leading to adultery
- Miscellaneous usage
In looking at the second to last bullet, this seems to be one of the two most common usages in the Old Testament with a plurality of the passages which use "desire" or "lust" sexually also referencing adultery. This becomes quite interesting then in that the sermon on the mount is often regarded as a restatement and summarization of the old testament law. In addition to the numerous condemnations of lust that cause divorce, the analogy of Israel being the bride and God the bridegroom is also at play. Thus the fact that some pharisees were divorcing because the wind shifted (See Matthew 19:1-11 - particularly vs. 3).
When we contextualize the scope of condemnation of desire to the context of lust that leads to adultery and divorce, a very familiar Old Testament theme emerges in the Sermon on the Mount with Jesus addressing divorce in the verses immediately following his statement on lust in 27-28 in 5:31-32.
Contextualizing in this manner also leads to some interesting questions and challenges. For example, is it sinful to lust after one's partner? I would suggest that a healthy sex life is an important part of a marriage, and this kind of lust is a good kind of lust that prevents adultery.
Similarly, one study found that couples that explore their desire and lust together through the use of pornography or are completely open and honest about their usage of pornography reported the highest levels of relationship satisfaction. Another survey found that men who use pornography were less likely to cheat on their partner. This raises a much more challenging version of the above question: is desire and lust which leads to stronger relationships and less adultery still sinful?
Lust of the Flesh
I have noticed a trend within pastoral teaching to equate "sins of the flesh" with sexual immorality. While sexual immorality is certainly a type of sin of the flesh, this is but a small slice of that pie. Throughout the epistles, Paul has developed a theology of "flesh" which is in contrast to "spirit" Paul enumerates a list of examples of fleshly sin in Galatians 5:19-21.
The acts of the flesh are obvious: sexual immorality, impurity and debauchery; idolatry and witchcraft; hatred, discord, jealousy, fits of rage, selfish ambition, dissensions, factions and envy; drunkenness, orgies, and the like. I warn you, as I did before, that those who live like this will not inherit the kingdom of God.
These are contrasted with the fruit of the spirit which Paul also enumerates in 22-23
But the fruit of the Spirit is love, joy, peace, forbearance, kindness, goodness, faithfulness, gentleness and self-control. Against such things there is no law.
Therefore, when we read "desires" or "lusts of the flesh" in the epistles (For example, Galatians 5:16-16) and impute a sexual connotation to them, this is a major misreading of Paul's meaning. While this can include sexual desires, it also includes jealous desires, desires for wealth, desires for power, desires for vices like drugs and alcohol. It is important that we not single out sexual desire and put it on the proper level with every other desire which does not further the Kingdom of God and the things of the spirit.
Similarly, we need to understand that much like there is a time and place for righteous anger, righteous jealousy, leadership, and fundraising and these things can further the Kingdom of God, the same might be true of sexual desire.
Knowing that unrighteous desires (sexual or otherwise) can be a type of "desire of the flesh" then allows us to gain some insight into the OP's question "Do you think the Scriptures make a distinction between desire and action when it comes to sin?"
In reading Galations 5:16-17, it seems that Paul is teaching that there is a distinction between unrighteous desire and actions:
So I say, walk by the Spirit, and you will not gratify the desires of the flesh. For the flesh desires what is contrary to the Spirit, and the Spirit what is contrary to the flesh. They are in conflict with each other, so that you are not to do whatever[c] you want.
Clearly, one can hold both desires of the flesh and desires of the spirit, and these things can be in conflict. Paul voices his personal struggle with this, saying in Romans 7:15
I do not understand what I do. For what I want to do I do not do, but what I hate I do. 16 And if I do what I do not want to do, I agree that the law is good. 17 As it is, it is no longer I myself who do it, but it is sin living in me. For I know that good itself does not dwell in me, that is, in my sinful nature. For I have the desire to do what is good, but I cannot carry it out. For I do not do the good I want to do, but the evil I do not want to do—this I keep on doing. Now if I do what I do not want to do, it is no longer I who do it, but it is sin living in me that does it.
Paul is clearly voicing a disconnect between his desires and his actions in this passage. His actions and his desires are not aligned, and incongruent.
Throughout the epistles Paul seems to be teaching that by drawing nearer to God, the spirit will work in our hearts to help align our desires to those of God's. By seeking intimacy with God, our fleshly desires will be reduced and help to make our actions more righteous by eliminating temptations and sinful desires of all types.
Conclusion
Sexuality is a foundational core to our human experience. In her book "Shameless: A Sexual Reformation" Rev. Nadia Bolz-Weber holds that all sexual unions, on some level, are holy acts. The very act of two people becoming one flesh, is a primal experience which returns us to the foundations of creation. It returns people to a state before Eve was separated from Adam, a time and state which God called "Good". To engage in the act of intercourse is to engage in a creative act which echos the goodness of creation.
It seems to me however that as holy as that goodness can be, just as the time of creation was tainted by sin, the same can be true of sex. Few things can evoke as much guilt, shame, and stigma as sex and sexuality. But this also means that conversely, few things have as much potential to allow us to experience the grace, freedom, and joy of the Gospel of Christ as sex and sexuality as well.
Therefore, how we communicate the Gospel as representatives of Christ is extremely important. Unfortunately, what this answer cannot do is answer the broader theological questions of whether homosexual desire or relationships are or are not sinful; that is simply beyond the scope of this question/answer and certainly too broad. But what we can conclude is that there are basically 4 possible outcomes: the right acts as a result of the right desires, the wrong acts as a result of the right desires, the right acts as a result of the wrong desires, and the wrong acts as the result of wrong desires.
Unfortunately, Matthew 5:27–28 does very little to inform our answers here, as this passage is specifically speaking about sinful desires that leads to adultery and divorce, and this passage has very little application to the situation in which the OP is considering. To try to extend this passage beyond the narrow scope of condemning desire leading to adultery and divorce risks imputing eisegetical meaning to the sermon, and is an attempt to put words into the mouth of God.
More broadly, our emphasis on condemning certain sexual acts (heterosexual or homosexual) and Christian culture's obsession with talking about sex and sexual purity seems to have sent a distorted Gospel message. This is readily apparent in the stories of those appearing in documentaries like Matt Barber's "Give Me Sex, Jesus" and can be seen in the hurt caused and alienation felt by those in the gay community and by many others. It can be heard in the stories' of most of those whom you talk to about the intersection of their faith experience and their sexuality.
As a hermeneutic guideline, the OP would do well to adopt the principle that given two equally plausible scriptural interpretations, we should prefer the one that will cause the recipients of the Gospel and hearers of the word to experience the fruit of the spirit - love, joy, peace, patience, kindness, goodness, and gentleness not so that the recipients may indulge the flesh, but so that they may experience the grace of God - especially with such as sensitive and impactful topic. This may often mean adjusting our messaging by being sure that our emphasis when preaching the Gospel is not distorted and lopsided so that the topics covered match the frequency of topics covered in the Gospels by Jesus.
1 Despite the fact I have titled this category "Sexual Desire" here, this category can be further explored and unpacked. Outside of Jesus' use of hyperbolic rhetoric, there is rarely (if ever) a prohibition on lust or desire generally in scripture - it is always in a specific, narrow circumstance. Outside of lust or desire related to adultery and coveting a neighbor's wife, the second most common prohibitions on sexual lust are in the context of Sacred Prostitution. Sacred Prostitution was always connected with other temple complexes and idolatry. Profits from this economic endeavor went to support other gods and sex was often ritualized as a form of worship. Sometimes the prohibitions on lust were not connected with prostitution, but instead ritual orgies such as in Rom. 1:27, Col 3:5. and 1 Thess. 4:5, but most often these prohibitions on lust were in one way or another connected to idolatry.