RepairPal Certified shops can diagnose and repair your 2002 Nissan Xterra. They provide transparent pricing with a minimum 12-month or 12,000-mile warranty on repairs and services.
Sounds like inspecting and or changing out the master cylinder and booster wouldn't be a bad place to start. Or you could have a vacuum problem causing the master or booster to malfunction even if they are not faulty