Chain and sprockets wear out together as a set, so they usually need to be replaced as a set otherwise excessive noise and wear will occur, or in a worst-case scenario, they will not properly intermesh with each other and the chain will skip over or stick to the sprocket's teeth.
The more time that a chain is used the more it "stretches". The chain's steel side plates do not actually stretch however its pins and bushings slowly wear out which causes the chain to get longer or "stretch" over time. As the chain is being used it gets longer on a very slow basis which allows the sprocket's teeth to wear out and reshape to the longer chain as these two parts wear out together in unison.
If a new sprocket is used with an old chain or an old chain is used with a new sprocket and they make excessive noise or they do not work well together, then the solution is to replace the old chain or old sprocket(s) with new ones so that the chain and both of the sprockets are new.