basically I was working on the answers with my friend and didn’t realize the questions were slightly different and therefore I used the answers we got that were based off of hers to mine. I am scared, what should I do?
From your post & comment, my understanding is that both of you worked on the questions together (i.e. you didn't just copy her answers without understanding how she got there) and to the best of your knowledge, there's no rule prohibiting students from helping one another with assignments.
If that's the case, I would recommend contacting the lecturer (or their assistant, depending on how the course is run) and explain the situation to them, and offer to redo your assignment with the correct questions. Make it clear that you didn't simply copy from work that your friend did, and that neither of you were aware of any rule against helping one another with assignments.
If you don't do this, there is a risk that they will notice the identical answers and assume that you copied from your friend. Depending on university policy, there may also be consequences for your friend if they assume that she let you copy. Even if neither of those things happen, you probably won't get a good grade for the assignment if you answered the wrong questions.
If there is a rule against collaborating on assignments... there may be some consequences, but it's going to look a lot better for you if you come forward instead of waiting for them to notice.
In the worst case, you have been caught in the act of submitting someone else's work as your own. I imagine that, even absent a statement on the course syllabus, the university has a policy statement on Academic Misconduct, it explains that this type of behavior is frowned upon if not prohibited, and you were told about the policy at some point.
The simplest form of punishment is that you will receive a grade appropriate to an incorrect answer.
The extreme form of punishment is that you will be called upon to explain yourself.
To mitigate against the worst extreme in the latter case, I recommend that you and your friend visit the instructor sooner rather than later. You should offer an apology from both of you. Your friend gave away her work to allow others to use as their own. No harm there, but she should have recognized that her work was not to be submitted by you for you to get a grade. You took her work and submitted it unaltered as a way to get a reward (a course grade) for no work on your own.
In the case where individual efforts are demanded for a question, team work is the approach where you get together, assure that you understand the question and how to do the work for it, and then each go home and do the required work on your own. Academic Misconduct is by comparison the case where you go home, each do some work to get to some type of answer, get back together, decide the "best" answer, and then submit that identical "best" answer for each of you. You did somewhat the latter rather than the former.
Lesson learned. You should hold no major anxiety. It happens all the time, and your case is very minor. Admit to it, apologize for it, promise and hold to the promise never to do it again, and move on.
In my university (a member of the UK Russell Group), your actions would be separated into two issues. First, there is the possibility of collusion, defined in our assessment regime as the act of working with other students to complete an assessment task meant to be completed individually. Second, there is the possibility of "copying", which is the submission of another student's work as one's own. One is no more or less serious than another.
It is likely that you will be found to have fulfilled the definition of "copying" on the evidence to hand. Whether you will be found to have met the definition of "collusion" will depend on whether the instructions in the assessment task, module handbook, Department handbook or similar document.
Under our assessment regime, if you are found to have breached the Academic Integrity Policy, an investigation will be held in which the evidence against you will be presented. You will be permitted to challenge the evidence and provide an explanation. If this is a first offence, then our policy allows for a range of penalties, the least severe being a zero mark for that assessment all the way to the most severe of a zero mark for the module. This depends on a number of factors such as whether this is your first offence, they egregiousness of the offence, the weight of the assessment, etc.
My advice is to contact the module leader or instructor right away and explain the situation. Be honest. In the event of an investigation under the Academic Integrity Policy, displaying insight, contrition and honesty will go a long way.