The bill’s path to approval caused upheaval in the Democratic ranks and put Senate Democrats in a tough spot.