AP test and classes

I’m worried about my AP scores I’m a junior and last year I took AP World History and got a two though to,admit it was our teachers first time teaching AP this year I took APUSH and APLang so I’m worried about getting twos on both of those and my question is can I get into a good university if I fail the AP test but pass the classes

You do not have to send AP scores to schools. If you don’t, they won’t be used for decisions. Mostly I think colleges look to see the grade you made in an AP course and that you have rigorous coursework. The schools my Ds go to only officially asked for scores after acceptance so that credit could be given for scores. You can certainly check individual schools, but didn’t run into any during our search that required them to be turned in as part of application to school.