Hex color codes are primarily used online to identify colors. RGB color codes are more commonly used in printers, screens, and programs.
These hex and RGB colors are typically used by web developers in order to create websites. However, they have other use cases too - for instance, when designing flyers or brochures. They also have a wide range of applications for graphic designers as well.
The benefits of hex and RGB color are the same for the most part. Hex codes offer more system-wide options because of how they can be divided into six groups of two digits.
Though both are capable of creating any possible color, the hex code model provides more flexibility when it comes to developing an image.
The best way to decide which coding system is better for you is by considering your project's use case and what your audience prefers.