Lawmakers still smarting from last fall’s record 43-day shutdown worked to avoid another funding lapse for a broad swath of the federal government.