Depends on the pipe size but 2" drain to vent is 5" max. There is a lot of water to remove when a washer pumps out.
Yep, my area allows max of five foot between trap and vent for two inch pipe also.