The medicine is best taken after meals.
I think it's an adverb modifying verb, but it can be an adjective after the copula.
Best is an adverb here, as Britannica explains:
2 best /ˈbɛst/ adverb superlative form of 1well 1 : in the best way : in a way that is better than all others
The sauce is best served/eaten/enjoyed cold.