How do I convert Arduino to an ATmega328P-based project?
A compiled sketch will run just fine on a bare ATmega328p, if all the necessary surrounding components are there, and if you have a way to program it.
This could be as simple as putting the chip on the Uno and programming it there. Don't do that too often; the socket isn't intended for that. You could get a 28-pin ZIF socket, though.
There are a few things to consider:

The bare chip needs external components like a crystal, etc. to function; you can check the Uno's schematic to see what you want to copy to your PCB/breadboard;
You may want to include a way to program the ATmega328p in-circuit using an ISP or a USB-to-serial chip;
The pin numbers will be different, a minor annoyance;
Possibly things I forgot.

There is a how-to on the Arduino site, and also a description of how to build a &quot;whole&quot; Arduino on a breadboard.