Most microcontroller pins can only supply about 20mA before burning up. This isn’t enough for most relay coils, even if you have a 5V relay. Use a transistor to amplify the current and keep your microcontroller safe.