The House passed far-reaching legislation that aims to curb online sex trafficking by holding websites more accountable for their users’ activities, a rare political defeat for internet companies.