Generally speaking it's cheaper to buy, as bike manufacturers have enormous purchasing power, and so can build bikes at a significantly lower cost than you.
The exception to this is if you have access to cheap second hand parts (or a large spares bin).
If building, you also have to factor in the tools required to build the bike. In time, tools will pay for themselves, but this initial cost will further increase your build price.
Very occasionally, at the higher end of the market, you may be lucky enough to find massive savings on a frameset, wheels and groupset which result in building being the best option. However, this is virtually impossible for sub £500 bikes.
It can be cheaper to buy a complete second hand bike that's approximately right for you, and then replacing the odd part.
However generally speaking, unless you're prepared to spend hours hunting down cheap components and waiting for sales, then buying a complete bike will work out cheaper.