I am new to electronics and ohms law is confusing. When I power the led with analogWrite and give it only 3 volts do I have to still use a resistor? When I power the led with 5 volts does it matter if I put a resistor before or after the led?
You always need to use a resistor with an LED (unless you're powering it from a current source where different rules apply as stated by jms or unless you have a special LED that has a resistor built into it but I highly doubt you have it and it's bad for learning about LEDs anyways). It does NOT matter if the resistor is before or after the LED, though in practice, you mainly see circuits with the resistor behind the LED.
To check what resistor value you need if you don't know or wasn't given any instructions with the specific LED you are using, use this calculator.
IMPORTANT: You should also note that analogwrite doesn't really output 3V, but rather outputs 5V that switches on and off rapidly to average on 3V. So honestly you should treat it like a 5V source. Treating the analogWrite as a 3V source can be risky.