(I added a couple of structural edits for better online reading.)
We may view this beautiful, hymn-like celebration of our security in Christ as a response to what Paul has just said (28–30, or 18–30 or even 1–30), but it is better to see it as a concluding reflection of chs. 5–8 as a whole. It falls into two parts.
In the first (31–34) Paul reminds us that God is for us: in giving his Son, he has at the same time secured for us all that we need to get through this life and attain final salvation. No-one, then, is able successfully to bring any charge against us, to cause us to be condemned in the judgment. For it is God who has chosen us and justified us and his own Son who answers any indictment brought against us.
The second part of the hymn (35–39) celebrates the love of God in Christ for us. It is as impossible to separate us from that love as it is to bring a charge against us. No earthly peril or disaster can do so (35b–36). Though such suffering can be expected, as Paul reminds us with his quotation of Ps. 44:22, in all these things we are more than conquerors through him who loved us. Nor can any spiritual power separate us from God’s love (angels, demons and powers in v 38). Indeed, there is nothing in all creation that can remove us from the new regime in which God’s love in Christ reigns over us.
Douglas J. Moo, “Romans,” in New Bible Commentary: 21st Century Edition (ed. D. A. Carson et al.; 4th ed.; Leicester, England; Downers Grove, IL: Inter-Varsity Press, 1994), 1142.