How to add sidebar to taxonomy page or node page?
Normally I'd advocate writing it yourself, but in this case there are modules that do exactly what you want.

Create a block for the taxonomy you want to display and only display it on certain URL's (I'd use the path alias module to create a specific URL for relevant content e.g. '/CONTENT_TYPE/CONTENT_TITLEand test for/CONTENT_TYPE/*` on the block admin page)

https://www.drupal.org/project/taxonomy_block

You can use the Menu Trail By Path module to indicate what the active trail should be in the menu.