dnd 5e – Can I cast Shield against an attack that hits me during a Time Stop?

Yes, you can cast Shield

Time Stop says:

This spell ends if one of the actions you use during this period, or any effects that you create during this period, affects a creature other than you or an object being worn or carried by someone other than you.

As soon as the caster Attacks or creates some effect that affects a creature other than itself, the spell ends. Once the spell has ended, you can act normally, allowing you to cast Shield with your reaction, turning a potential hit into a miss.