Is this lamp junk? If so, cut the wires right here

Strip those wires, get some orange wire-nuts, and splice the new lamp's black/white to the like colors. And you're done.

That was too easy. What about all those other wires?
Pay no attention to the man behind the curtain.
The simplest explanation is those wires "don't belong to you", or to be more precise, don't belong to the scope of your project. They have other, unrelated but important jobs to do, whatever they may be -- I suspect in this case, they carry power onward from this box to serve other loads in your house. Messing with them will break that, but fortunately you don't need to.
Now in the last few weeks, we've had literally a question a day of "I'm changing a lamp or fan and there are all these other wires up there and I want to know about them / I am worried about them / I want to play with them / I took them apart and HALP". Yes, we really do get the latter, one memorable one really went sideways on him.
The difficulty in giving an answer is they're all different, and a lot of things are just un-knowable without a lot of popping covers off and testing - obviously one of your cables goes to the switch, but I can't guess where the other one goes.
And often the motivation is to learn about electricity, which is awesome. But even at best, trying to learn via chance-encountered bits and spurts of knowledge (e.g."Google learning") is a dreadfully time-inefficient way to learn, and gives swiss-cheese knowledge - essential things never get mentioned. The right way to approach this is to curl up for a few evenings with a "how to wire houses" book from the library, and then blend in a fair bit of searching here to add color. And then you'll look at that and go "Oh, yeah."