How do you differentiate the difference between a mirrorless and digital camera?
But to answer the title question. If the phone's sensor is inferior to the digital camera's sensor, the latter will produce a superior image. If the camera's sensor is superior to the phone's sensor, the latter will produce an inferior image. If the phone's sensor is superior to the digital camera's sensor, the latter will produce an inferior image. If the camera's sensor is inferior to the phone's sensor, the latter will produce a superior image.
And to answer your post. The phone camera will only be a lot worse if the non-phone camera is a lot better.
75% of taking good photos is a good working knowledge of the art and science of photography, planning and a little luck; 15% Post Processing skills, and 10% camera gear as long as it meets a minimum quality level and modern smartphones certainly exceed the threshold. So, I can take great photos with my iphone 14 pro max as well as with my Z9, but the iphone is more suited to portraits and landscapes, where my Z9 excels at sports, nature and wildlife, but is also very good at portraits and landscapes.
Physics is involved here as well. One should not expect to get the same quality image with a 7mm x 5mm 12mp sensor behind a very small plastic lens compared to a 36mm x 24mm 46 mp sensor with a big chunk of expensive glass in front of it.