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.