These are smartphones. Every once and awhile you'll have hangs, crashes, etc in the programs. Restart the device or do a soft reset (power + home) if needed.
As for hardware issues, if you're buying them new you've got a year warranty.
I'm sorry to hear you're going through this.