Before you attach a new barrel to your AR-15, it's important to check headspace. If the headspace isn't correct you need to fix it before proceeding.
Start with a stripped bolt. It needs to have both the extractor and ejector removed to prevent any false readings when using the headspace gauges.
A go and a no go gauge are needed for this process. The go gauge is sized to the minimum allowable headspace while the no go is over the max.
Because fouling brass shavings or other debris can affect the measurements, you must first clean the chamber thoroughly.
Insert the go gage into the chamber.
Now slide the bolt into the barrel sleeve. You should be able to turn the bolt and engage the locking lugs completely. This lets us know that the chamber has at least a minimum amount of headspace.
Now repeat the process using the no go gauge.
You should not be able to turn the locking lugs completely into battery.
If you can then you have excessive headspace and should not fire the gun. A different bolt may correct the problem. Otherwise, you'll need to replace the barrel. In either case, the gun must pass the headspace test!