Different than defensive holding or pass interference, the penalty constitutes contact initiated beyond five yards from the line of scrimmage while the quarterback (or any player who receives the snap) is still in the pocket.
Per the NFL Rulebook, contact is legal within five yards of the line of scrimmage, as long as the it remains continuous within the five-yard window. All of the following are considered illegal contact: If a player makes legal continuous contact within five yards of the line of scrimmage that they extend beyond the five-yard window; if a player initiates contact outside of the five-yard window while the the player who received the snap remains in the pocket; finally, if a player initiates contact (regardless of where on the field) with the back of the receiver. All of the above would constitute illegal contact and result in a flag against the defense, costing them five yards and an automatic first down.
An example of illegal contact can be seen below, courtesy of Minnesota Vikings cornerback Terence Newman in Week 3 of 2016 against the Carolina Panthers. Newman is in off man coverage against Panthers wide receiver Devin Funchess (#17) as the Vikings run Cover 1. Funchess runs a double move, faking a hook route before continuing vertically on a go route. Newman is fooled by the double move, and begins to move forward to defend the hook, only to realize too late that Funchess is going to continue down the field. Once Newman recognizes his mistake, he makes contact with Funchess to slow him down and prevent a big play down the field, drawing a flag for illegal contact, as he made contact with Funchess outside of the five-yard window.
When the offense aligns to punt, the rules are different. Contact is allowed downfield as long as it does not break the rules for defensive holding. This allows defenders to block players like punt gunners as they run down the field, providing the receiving team a chance to set up blocks for the punt return.
There are certain variations to the illegal contact rule, which apply only to specific circumstances. For example, illegal contact against a player who has called a fair catch is a 15-yard penalty, and can also result in an ejection if the officials deem the act to be flagrant. This penalty occurs after the fair catch has been made, and differs from fair-catch interference, which is when a player impedes the receiver’s ability to make a fair catch after calling for it.