As with most other chars vs Sonic, Sonic has tools to punish Sonic after shielding SD/SC. I'll list a few:
1. If you shield a Spin Dash and they believe they have a hit confirm and go for a NAir.
You can punish with BAir. If they DI further behind you, make sure to hold back. If they DI towards you, you can punish with either UAir or BAir (DI'ed forward)
2. If you shield a Spin Dash and they follow up with an UAir.
I believe BAir isn't guaranteed unless it's perfect shield with OOS BAir. However, if they don't air dodge immediately, you can go for the BAir and there's a good chance it will connect. Usually you can punish this with UAir, especially if they DI'ed towards you instead of away from you
3. If you shield a Spin Dash and they follow up with a spring. This is a bit more complicated. Sorry if it's a jumbled wall of text.
You need to guess this. There are a couple factors to keep in mind to help you guess this. Obviously if your opponent never does this, you don't need to worry about this (this isn't too common for most Sonic's you fight to do this). If your opponent is aware of this option as a mix up, here are a few clues for when they will use this option. If you've been shielding for a while, they will assume you will continue shielding and if they try to do an aerial immediately after, they will get punished. They will often use the spring in this case. If you perfect shield, they need to guess if there was a hit confirmation and either go for the aerial or go for the spring. Simply put, if you're shielding for awhile/some time, you are more likely to face this option. Countering this option is simple. Simply continue shielding. Keep in mind that if the opponent delays the spring, he can bait a punish from you and punish you with this spring option. Position yourself in front of where they would land if they DAir (in front of Sonic by about 4 Sonic lengths). Make sure to confirm that they are using DAir and input a punish before they land. Smashes need to be inputted much earlier by Sonic and would be considered a read. Grabs and jabs can be done on reaction. Use this to your advantage if you're just fishing for damage or for kills. If they don't do DAir, stay on the opponent and try to punish their landing. Good punishing choices are pivot FSmashes, grabs, dash attacks, and in harder read situations, SD/SC can be used. Sometimes FTilt and Up Smash can be used. If they are trying to cross you up, you can go for turn around grabs and turn around jabs on reaction.
4. If they 'stop' at your shield with SD/SC.
If they stop at your shield, jab/grab on reaction.
5. If they go past you on the ground.
Be prepared for them to possibly come back. Don't roll in this situation as it can sometimes catch you if you roll. You can, however, often get a free dash attack on them, especially if your back is near the ledge. They will be turning around with no hit box and your dash attack will beat their turn around in this situation. Keep in mind that if you do a dash attack and they jump instead of turn around, they can usually punish with a spring or at least land back on stage for free.
There are more options for Sonic to do after a shielded SD/SC (like double jump either forward or backwards, air dodge, etc) but these ones tend to have much higher variance and I didn't want to go through all of it. This advice is applicable in any match up vs Sonic, but hopefully I listed some specific options that Sonic has vs Sonic.