[noun] + のような + [noun] [noun] + のように + [verb] [verb (plain)] + ような + [noun] [verb (plain)] + ように + [verb] [i-adj] + ような / ように [na-adj] + な + ような / ように
ような and ように mean "like" or "as if": they compare something to what comes in front of them. A noun takes の and a な-adjective keeps な; a verb or an い-adjective in the plain form attaches directly. Both come from the noun よう (様), "appearance".
The word that follows decides. ような works like a な-adjective and goes before a noun. ように works like an adverb and goes before a verb or an adjective.
At the end of a sentence, it is ようだ or ようです.
A verb in the plain form gives "as if": the past for something that seems to have happened, the ている form for something that seems to be going on.
ように after a verb can also mean "as", "the way": the way someone said or did it.
These go beyond comparison.
のような also gives an example of a kind, and the noun is then one of them.
ように after a verb nobody does on purpose, followed by an action, means "so that". That is a separate grammar point.