The reason why you want to avoid using a carpet cleaning machine on upholstery is that carpets are thicker and need a lot of water to get clean and this excess of water on upholstery items like sofas or mattress can be too much.
Some carpet cleaner do have upholstery attachments, and that is fine to use. But if you can avoid using a carpet cleaning machine and instead use a proper upholstery cleaner that would be prefered.
Important: Always test a cleaner out in a small hidden area to make sure it won’t damage the furniture. If you have a color transfer on a rag, then stop using that cleaner. Most items have a tag that tells you how to maintain and how to clean the furniture.
What To Do Instead
It would be best to avoid using any cleaning process that uses excesses amounts of water on upholstery items. It’s best to use an actual spray cleaner or have a professional clean the sofas and mattresses.
Never use a machine cleaner like a carpet cleaner or steam cleaner to clean a mattress as that is the worse thing you can do. A soaking wet mattress almost never fully dries out and using too much water just spreads the nasty around. The water that doesn’t escape gets trapped and starts to grow mold. It’s best to use a mattress protector on a mattress to keep stains from getting to the mattress.
What you use to clean upholstery items depends on the stain. Most carpet stain removers will work, but they do make upholstery cleaners that work far better. Most people only have carpet spray cleaner, and they will work fine, but I recommend spraying a rag first not the stain. This will keep you from over saturating the furniture.
If the stain is organic, such as vomit, urine, feces, or even milk, then I would consider using an Enzyme Cleaner.
If the item is leather, then you want to avoid using common spray cleaners. Also, if the upholstery is made of velvet, silk, or vinyl, then you want to avoid regular carpet cleaner sprays too. These items each have their own versions of cleaners that work best for them.