Was the expansion of space time during big bang uniform if so how come the stars and planets be formed because and matter as well as gravity would have been same everywhere
Your question is one that bothered cosmologists for a long time, how do you get clumps of matter out of a smooth initial condition, in the time allowed? It was long understood that a perfectly smooth matter distribution could not be maintained forever, because gravity creates instabilities-- the smallest overdensity in one region would tend, over time, to pull in more matter and increase the overdensity. But this takes time, and the CMB measurements were coming in surprisingly smooth-- so how did galaxies and stars form in less than a billion years, given that very uniform initial density?
The answer seems to be dark matter. Dark matter increases the mass and therefore the gravity, so it reduces the time it takes for instabilities to develop and overdensities to grow. So the simple answer to your question is that even though cosmology assumes a smooth initial density, it does not say the density is exactly smooth, and indeed the CMB tells us there are tiny density variations (you can look at the tiny variations seen by the PLANCK satellite at https://en.wikipedia.org/wiki/Planck_(spacecraft)#/media/File:Ilc_9yr_moll4096.png, for example-- the scale shows variations of 1 part in ten thousand). Then gravitational instability increases the overdensity, but needs stronger gravity to do this in the time allowed, so that appears to be provided by dark matter.