I've heard that materials that need to slide against each other should be of different materials. Why is that?
In addition to ashgetstazered's answer, some materials (Aluminum, I'm looking at you!) will gall badly when meshed against themselves, while moving reasonably smoothly against a different material (e.g. bronze bushing). So if you have a good reason to produce one part out of a given material, you then choose the mating part's material to minimize galling or wear.
As already mentioned in many contexts you will make one part essentially consumable in order to reduce wear on an expensive or difficult-to-replace part.
Similarly if you have a situation like a shaft mounted in a cast iron casing (eg an engine block) it makes sense to protect both, relatively complex and expensive parts with a cheap, expendable and easily replaceable intermediate e it a bearing or bushing.
Another reason is that a lot of materials that have good friction properties may not be suitable for both parts; e.g., sintered bronze makes good bushings but you wouldn't usually want to make a shaft out of it. A similar situation is white metal bearings, which are cast in place and a relatively low tech way to get a high tolerance fit. Similarly, bushings are generally well-supported so it's often acceptable to favour good friction characteristics over strength in a way that you couldn't with a shaft.
Another consideration is galling. This is effectively cold welding of touching surfaces under load, which ends up tearing chunks off one or both surfaces, causing deep surface damage at a much faster rate than straightforward wear. Some metals or combinations of metals are particularly vulnerable to this; e.g., stainless steel.
There are also manufacturing considerations. It's generally easier to make an accurately round shaft than a hole, so bushing materials will often be relatively easy to machine or at least tolerant of size variation. For example, if you fit a steel shaft in an undersized nylon bushing, it will fairly quickly wear itself in to a reasonable bearing fit without harming either part, whereas a steel shaft in an undersized steel bushing would be in risk of scoring or seizing up altogether.
However, there are equally circumstances where similar materials are fine, especially in contexts where overall wear needs to be minimised or where it's possible to provide good lubrication. In a fluid dynamic or hydrostatic bearing, the bearing surfaces should never actually touch as they are held apart by pressurised lubricant.
The specific materials matter as well for example aluminium-on-aluminium sliding would be much less desirable than cast iron on cast iron.
I haven't heard this bit of advice and as with most things in engineering it really comes down to WHICH materials and in what CONTEXT.
I can think of one main reason why you might want to make them out of different materials: Differing hardness. What this means is that only one of the materials should 'wear' and then you could design it so that this part could be changed out easily. For example: if you had something following a guide, you wouldn't want to have to replace the whole guide when it started to wear, so if you make the thing that follows the guide softer then it will wear and you can just replace that.
But yes. Without more information I can't really give any more advice. That statement is not universally true though.
For a sleeve bushing, you want a soft slippery material with sufficient yield strength to withstand any deformation of the hole surface during operation. For the shaft, you want a hard smooth material with sufficent yield strength to withstand being deformed/bent in order to ensure that the surfaces of the shaft spin true to the axis of rotation at all times during operation. You want as close a possible fit as you can get, you want it to feel slightly snug with a small amount of friction. Spin the parts while not under any load and the rotating surface of the shaft will lap the bushing until there is zero friction and it helps to move the parts in and out along the axis slightly to eliminate as much material as you can from the bushing surface until it rotates freely. If you do all these steps and tolerance your parts correctly and use the right materials, you will have a perfect rotating bushing joint. Make sure to factor in the loads it will be operating under, and make sure to follow the guidelines above, and these kinds of joints can withstand a few hundreds of pounds with very low friction comparable to a ball bearing and gets smoother and looser as time goes on and the bushing continues to wear. You just want to prevent deformation and reduce friction.