Batteries with Uno

I am creating a project that needs to be powered by batteries. I have an Uno connected to an MPU 6050 and HC-05. Is connecting a 9V battery through the power socket completely fine? I have both the MPU and HC connected to the 5v pin and resistors connected to HC so it works properly connected to 5v. I've seen some forums saying there are other options. Should I use AA batteries instead? Or connect the battery directly into the GND and 5v pins instead of the socket? I want everything to be powered correctly without frying any of the pieces. Thank you

The only problem with a PP3 style 9v battery is its very limited capacity. A pack of 6 AA cells (9v) will last much longer.

You could also connect a pack of 3 AA cells (4.5v) to the 5v pin and GND.

...R

The UNO is not a good fit for battery power. It has a voltage regulator, USB adapter, and a power LED, any of which draw way more current than a sleeping ATmega328p. A better choice might be a "Bare Bones Board" running at 8 MHz off a lithium cell. Some specialized Arduino clones have a built-in LiPo charger so they can be charged through the USB adapter.