For K-cups, we have this drawer which works great to save counter space since it fits under the machine. We have a big machine though so it might be too big for smaller Keurigs.
https://www.amazon.com/dp/B00XBLGRES/ref=cm_sw_r_cp_apa_fabc_C88B9XR4BTDYNZ290CGA
For tea, I would use a tea box like how others suggested. I tend to use loose leaf tea, though, so I use canisters from Ikea.
https://www.ikea.com/us/en/p/blomning-coffee-tea-canister-00373207/