I think this is one of those situations where people like to stuff the 'rules of writing' down your throat. As if writing has some sort of book of law and if you break it you'll spend your entire career sharpening pencils in book jail.
Alliteration and assonance, like everything else in writing, are tools to spark the imagination and emotions of the reader. A great example of this is a rather infamous line in the metamorphoses by Ovid where Daedalus searches for his son Icarus that plummeted into the sea:
at pater infēlix, nec iam pater, "Īcare," dīxit,
"Īcare," dīxit "ubi es? quā tē regiōne requīram?"
"Īcare" dīcēbat: pennās aspexit in undīs
Notice how there is the assonance of 'i' sounds in these lines, invoking the image of his father flying and circling above, like how a seagull would searching for fish, with frantic 'iiii iiii iiii iiii's.
Alliteration can do the same, for example, to show rage, you can use deep, rumbling consonants. R's, T's, V's or even hisses in the forms of H's, G's and S's. An example of this is the dialogue of Smaug in the hobbit.
“My armor is like tenfold shields, my teeth are swords, my claws spears, the shock of my tail a thunderbolt, my wings a hurricane, and my breath death!
Likewise, you can use softer sounds to show affection or insecurity, or really any emotion. Obviously though, there's a downside to all this.
It's hard to use
If you are not experienced enough in writing, it would be like handing a crafts student a spark welder, or a circular saw. Sure, those tools are useful and invaluable to constructing things, but your teacher is going to scold you and tell you to put that thing down immediately and not go near it again. It's really easy to gravely hurt your writing with overuse of alliteration or assonance, and in turn wound the pace, rhythm and rhyme of your prose.
It is the same in any other craft, in all honesty. Any literary rule can be broken, and the molds in which you cast your story re-envisioned. But if you don't know what you're doing, you're far more likely to end up with a grey mess of paint on a ripped canvas, or a wonky sculpture, than a masterpiece. The very same goes for writing, and that shouldn't stop you from experimenting with it either, since it takes a hundred wonky things before you get good. Just know that it can go badly as well, and not to be afraid to make changes or scrap the part altogether when it does.