This will work fine although I believe you will get faster charging if you connect the iPhone to the power adaptor directly, instead of using the MagSafe charger. The 30W power adaptor will provide somewhat faster charging than a 20W power adaptor, although there is a limit to what the iPhone will accept. See link below to a related discussion here on MacRumors.
The MagSafe is a convenient way to keep the devices charged but it doesn't deliver the charge as fast as a direct connection.
Despite not being advertised by Apple, the iPhone 13 Pro Max is capable of faster charging at up to 27W speeds when connected to a 30W or higher...
www.macrumors.com
Notice that Apple's own description of fast charging mentions only using a USB-C to Lightning cable:
Fast charge some iPhone models.
support.apple.com