You can use clipped() here to fix this
VStack() {
Text("Text")
.background(Color.red)
.padding()
.padding()
Text("Text")
.background(Color.purple)
.padding()
}
.padding()
.background(Color.white)
.clipped()
.shadow(color: Color.red, radius: 10, x: 0, y: 0)
Output:

Hope it is helpful 🙂