There is a reason the shotgun was replaced by the AR.
Less recoil, easier to aim, easier to add sights, lights, or can openers. While giving many more shots on tap in the free states.
Another big one that is overlooked is less penetration through dense objects with a light weight high velocity rifle bullet. High speed rifles punch through thin hard barriers better, which is why they do more damage to soft body armor or thin hard materials not rated to stop them, but they go through more overall medium worse.
An AR-15 firing the same number of rounds poses less risk to neighbors than a shotgun and especially a shotgun with slugs.
While both will go through walls pistol bullets actually penetrate more material and stay together longer than a light weight high velocity rifle bullet. Shotguns with slugs even more so. They will sail through a whole house and come out the other side and do it to the next house too. Especially if you are using solid harder alloy brenneke slugs instead of soft fosters. The harder brenneke may also do less damage than a softer slug that expands more on hitting bone and tissue, and the only thing it will do better is hold its shape and go through a lot more objects before it stops.
The lighter AR rounds can break up into many small fragments after hitting an appliance or piece of furniture or a brick and pose much less risk down the street. They have a lot of energy but less momentum. A slug keeps going through soft material until it has spent all that momentum. While both will do a lot of damage to soft tissue the AR is designed to dump all of its energy very fast, and the shotgun slug will punch a shotgun slug sized hole right through the target and a lot of things behind it. Both are serious wounds and will get the job done, but the AR puts the energy where you want it and less where you don't.
So an AR with light weight high velocity rounds does good wounding, will penetrate soft body armor better, and penetrate homes worse. While having 10% of the recoil, and you can readily put whatever you want on the gun from a light to a red dot to night or thermal vision or tritium iron sights and you can keep changing your mind and swapping things out on the rails.
The shotgun used to be much cheaper but now a decent shotgun is close in price to an AR-15, and many shotguns on the lower end new have burs and finish and fit issues. They are devastating and with slugs it is very much like a musket. That is not a trivial weapon, muskets were taking off entire limbs in the civil war.
Interestingly enough slug hunters on common game like deer actually pose more risk to people within range than a safe rifle hunter with a light caliber. The slugs will go through brush and small trees and hit things not in line of sight more readily. The rifle is only worse if people aim it above the horizon as they will go a longer distance but through less objects. A slug also weighs so much that even falling at terminal velocity fired straight up it can kill you, while a rifle round falling at terminal velocity may just bounce off you. The rifle requires an arc to come down with some of its original velocity to pose serious risk.
The most effective shotgun performance was also with standard loads. A lot of the reduced recoil rounds common today are even less powerful. I still like a shotgun but a shotgun with slugs, especially solid brenneke type, is a weapon you need to know what is in the direction you fire for hundreds of yards through multiple walls. Outdoors a rifle is much faster and more accurate at a distance, and a shotgun more versatile to safely kill things with less risk of dangerous ricochet at short range using shot.