EDITED ANSWER: I apologize. I read your question wrong.
Hi, Sara!
年前 = years ago (must be preceded by a number)
去年 = last year
Examples:
两年前我从高中毕业。= Two years ago, I graduate from high school (literally: Two years ago I from high school graduate).
十年前我和我妻子结了婚。 = Ten years ago, my wife and I got married (literally: Ten years ago I and my wife married).
去年我拿到了我的驾驶执照。 = Last year, I got my driver's license.
你去年才找到工作。 = You didn't find a job until last year (literally: You last year just found job).