This is a classic dryer outlet issue.
First, welcome to the DIY forum, the people here know a lot about electrical safety. 120V is dangerous stuff, and it only seems safe because we have good electrical codes.
What you have there is the normal/classic issue when transitioning from the old dryer socket to the new. Here's a mugshot line up for you. The triangle shaped hole in the older socket does nothing (except help the plastic molding not crack when it cools).
Back around 1955, engineers and fatality reports finally convinced the NFPA that grounding appliances was worth the copper. (Ground is the green wire above). In 1966, they took on 240V appliances and imposed grounding requirements for them, causing the NEMA 6-30 and 14-30 types to become the law. (depending on whether the load needed neutral; dryers and ranges do).
However, cable manufacturers complained because this would instantly destroy the value of tens of millions of dollars of now-unusable cable types (ungrounded #6-10 NM and #8-10 SEU). And appliance makers complained the transition would hurt sales. Their logic was "dryer and range connections are rarely disturbed, so shouldn't fail much". So NFPA gave them "a few years" to adapt to grounding and to use up the old cables. Once those were gone, Code required they use grounded cables and on a NEMA 10-30, cap off the ground (or tie it to the metal junction box as per Code). This would allow the homeowner an easy transition to NEMA 14-30 socket.
Unfortunately, many builders illegally used /2 w/ground cable, misusing the ground wire as neutral, which it's not insulated for. We insulate neutral for good reasons, and one of them is what makes NEMA 10 so dangerous. A neutral wire break at the panel will put 120V both on the chassis of the dryer and also the neutral wire in the cable! That accumulating a body count is what finally spurred them to change Code in 1996, and it keeps happening. (it's misreported in the news as a "miswired" outlet, when in fact it was properly wired for pre-1996 Code, but developed a loose connection.)
So several paths based on what you find.
- If there is a bona-fide ground in the box (either from a 4th wire in the cable, or metal conduit with ground on the metal pipe), then you can simply install a NEMA 14-30 outlet and good2go.
- If there is no ground and the cable is "/2 w/ground" NM-B type with ground unsafely wired to neutral, that is illegal and there's nothing you can do. Except use the ground for ground and attach it to a NEMA 6-30. Use a dryer that doesn't need neutral. These will be hoity-toity European models, possibly with advanced features like heat pump drying. Bummer!
- If the wire was legal pre-1996 (either white neutral, or mesh neutral in SEU cable), and you really, really want to put a NEMA 14-30 there anyway, then you can use the GFCI loophole. Protect the socket with GFCI (only way is by use of a GFCI breaker that is correct for your panel), and label the socket "GFCI Protected / No Equipment Ground".
- Last option: The wiring was legal and installed before 1996. That means it is grandfathered as long as you don't change anything. So you can leave the socket at NEMA 10-30 type, and follow the procedure in your dryer's instructions to change the cord to NEMA 10-30P.
What that procedure does is tie the dryer chassis to the neutral wire. It was a stupid 1966 compromise that the data proves didn't work, but hopefully you don't like your tenants all that much lol.
By the way, the GFCI loophole applies to all your other swaps.
You mentioned in comments that you do a lot of swapping ungrounded receptacles for grounded ones. Of course, there is an epidemic of people just changing the receptacles so their plugs fit, furling out the "Mission Accomplished" banner, and ignoring the safety angle to it.
That is unnecessary. Thanks to the GFCI loophole, and a neat feature of GFCIs where they can protect onward wiring that goes beyond them, you can install 3-prong GFCI receptacles anywhere, and plain receptacles if they are a) fed from the "Load" terminals of a GFCI elsewhere, and b) marked "GFCI Protected / No Equipment Ground" in any manner not handwritten.
If you are making a more elegant label (e.g. on a label maker rather than using the supplied stickers that are ugly), it's also wise to also state where the reset is located.
The reason the sockets (including the GFCI receptacle) must be marked "No Equipment Ground" is to warn the owners of computer or audio equipment that they cannot rely on the grounds for ESD protection of the equipment.