A sex offense (also called a "sex crime") is a artificial category of offenses created by those who wish to criminalize (and sensationalize) sexual activity which they oppose, usually on moral grounds.
Sodomy laws in the past have defined many normal sexual activities as being "sex offenses," such as masturbation, fellatio, cunnilingus, exhibitionism, voyeurism, etc., even when these activities occur completely voluntarily, and between persons of any age.
Whether a specific activity--sexual or non-sexual--qualifies as a "sex offenses" may depend on the reasons behind the activity in question (the "intent" in the mind of the perpetrator).
For example, one person may place his or her hand on the knee of a boy or girl sitting beside him/her, and that person may not be committing a sex offense.
Another person may place his or her hand on the knee of a boy or girl sitting beside him/her, and that person is committing a sex offense, if the person placing the hand finds the boy or girl to be sexually attractive.
Many BoyLovers have been imprisoned for activities which, if the same activity had been performed by someone who is not sexually attracted to boys, would not have been an offense, sexual or otherwise.
A "sex offense" may even include activity which is not even traditionally considered to be sexual activity. For example, public urination is a "sex offense" in many jurisdictions. The "logic" behind this is that the penis is a sexual organ, and that the exposure of the penis in public may lead to the viewing of this sexual organ by another person, and this may be somehow "harmful" to the other person, especially to those who have not yet reached the age of 18 years old. A person who has turned 18 years old is assumed to have suddenly become immune to any serious damage, according to this theory. But if the incident had occurred one day earlier, then the pre-18-year-old "child" would have been seriously (and perhaps irreparably) damaged for life, and would have required long-term (and very expensive) "psychological treatment" to minimize the damage.