From the NFL rules ..
SECTION 5 - FOULS BY BOTH TEAMS (DOUBLE FOULS)
ARTICLE 1. DOUBLE FOUL WITHOUT CHANGE OF POSSESSION
If there is a Double Foul (3-14-1-e) during a down in which there is not a change of possession, the penalties are offset, and the down is replayed at the previous spot. If it is a scrimmage down, the number of the next down and the line to gain is the same as for the down in which the fouls occurred.
Exceptions:
- If one or more fouls by one team includes a 15-yard penalty, and the penalty for the foul or fouls committed by the other team is for a five-yard penalty without an automatic First Down, a loss of down, or a 10-second runoff (15 yards versus five yards), or that is not a spot foul, the 15-yard penalty is enforced from the previous spot, and the five-yard penalty is disregarded. Five vs. 15 enforcement cannot be declined by the team that committed the minor foul, except as described in (2) below. See 4-8-2-h and 14-4-9-Item 3-Exc. 1 for dead ball fouls at the end of a half.
- If one of the fouls is a Dead Ball Foul for delay of game for spiking the ball and the opponent’s foul is a Live Ball Foul, the team that committed the delay of game foul, in addition to Article 1 above, will have the option to decline the foul committed by its opponent and be assessed the penalty for delay from the dead-ball spot.
- If both fouls are Dead Ball Fouls or are treated as such (14-4-9), the penalties are offset, and the ball is next put in play at the succeeding spot, unless the Dead Ball fouls occur after the ball has been made ready for play, in which case 5 vs. 15 enforcement applies.
As the rules state above, sometimes the 5-yard penalty (depending on the type of penalty) is disregarded when the other team is flagged for a 15-yard penalty.
That said, you cannot really compare penalties based on yardage because 5-yard penalties are the minimum pre-defined yardage numbers and 15-yard penalties are the max pre-defined yardage penalties.
Of course there are non-predefined yardage penalties such as pass interference, but sometimes a player may commit a penalty as a direct result of the penalty the other team committed prior to that in the same play.
If they were going to enforce both penalties, the NFL would need to increase the yardage of various 15-yard penalties to reflect the seriousness of those as compared to lining up offsides, illegal contact, etc.