Hello and welcome to JustAnswer!
P0573 is "brake switch number 1 circuit high". This code could be caused by a bad brake switch, wiring, or the powertrain control module (PCM). The brake switch is mounted to the pedal bracket and has a plunger that rides on the brake pedal arm, opening and closing as you press and release the pedal. While this could be a PCM or wiring issue, it's very likely just the brake switch which is a quick and inexpensive repair.
P0340 is for the camshaft position sensor. The cam sensor is mounted to the left end of the cylinder head and reads off a tone wheel on the intake cam. This code could also be caused by the PCM or wiring to the sensor, but it's very likely the sensor. Cam sensor failures on the 2.4 aren't unheard of. If your wiring and connections look ok then you are very safe with replacing the sensor.