Do rugby teams ever use different formations the way football teams do? e.g. instead of left and right wingers, using narrow and wide specialists, replacing a back with a loose forward, etc.
...replacing a back with a loose forward, etc.
The closest thing I ever saw to this was Pierre Spies. He played schoolboy rugby on the wing and became a forward relatively late in his playing days.
This meant that he was a forward that had the speed of a wing, The bulls would often use him as a huge backline player in that famous team of 2009.
That was the exception to the rule, though. For the most part, rugby's positions are highly specialised and when it comes to top tier rugby you need players that know the position well.
Do rugby teams ever use different formations
In the backline yes, often. Coordinated backline moves are for me the best part of rugby. It is to me the tell-tale sign of a well-coached team. Deception in backline play is a hugely interesting part of rugby coaching.
No. The positions are fixed and each player will have to fill those positions. As far as position formations there are no variations like there are in football.
However, during a match, depending on strategy players may either swap position or location on the field during a phase or 2, but only really skilled teams can do this since it is important to fill your roll and have the knowledge that the guy next to you is where you expect so you can pass to them.
In other cases utility players (typically backs) can be skilled enough to fill a different positions. (i.e. a player may be able to play full-back, or wing). Nowadays teams like the All Blacks pick players that can fill different positions off the bench. Forwards tend to be rather specialized so don't mix so much. Really only the flankers (6/7/8) could have players interchange but the tight 5 are so specialized they tend to stay in that position.
In rugby,the different formations are generally concentrated on the forwards.In other words,the forwards are set around the field in a certain formation while the backs position themselves according to the forwards'formation. For example, coaches sometimes use the formation called the 1-3-3-1 formation. In this case you have four pods of forwards. One pod on the one end of the field containing one forward(preferably a more agile,mobile player). Two pods in the midfield each containing three players. And the last one again on the opposite end of the field as the first pod, containing also just one player. This is why they call it the 1-3-3-1 system.