I received the check in the mail, deposited it and now waiting for it to clear the bank. The company is now threating to sue me for withholding company funds, if I don't send the funds to them in which I cannot due to the bank holding the funds... What do I need to do?
The pattern you describe fits a very common scam. The scammers send money to the victim by a reversible transaction, like a check which can bounce after initially being cleared. They ask the victim to send some of the money back (or to someone they call a third party, but who is really part of the scam) by an irreversible transaction, like cryptocurrency, gift cards, or many other ways. Banks are aware of this scam and might have stopped the check because it was suspicious.
Do you know that the company is legit? Have you been to their offices? If it is a major, well-known company, have you phoned their switchboard on a number you looked up (from a source unconnected to the possible scammers) and asked to be connected to the right department? Otherwise, there is a high likelihood that they try to scam you.
But either way, you are now involved where it is the smartest thing for you to report this to the police. Either the company handed you a dodgy check, or the bank is keeping funds from you. Go to the police, report it, and tell the company the case number. If that makes them go away, they were scammers. If not, the company can argue with the bank and the police.
There are many scams where companies you are not familiar with send you checks which turn out to be worthless. If you have not been an employee of this company for a substantial period of time (several months if not years) I'd report this to the police. Don't send them any money and don't buy any equipment until you are sure the transaction is truly and completely cleared.
This can take months, because the company the account is drawn on gets to wait for the monthly statement to arrive, then a few weeks to notice that there is something not right on the statement, and then some time for the bank that is supposed to pay the check to reverse the payment, and for the reversal to work its way through the system to your bank.
Also, heed the comment by EJoshauS. The idea of eventually doing anything with the money assumes that the original post was incomplete and there are circumstances that make this legitimate. If the original post told pretty much the whole story, there's no chance this is legitimate.
This is almost certainly a scam.
For one thing, I've never had a company send me a check to buy my own equipment myself - they always purchase it themselves through their usual requisition process and give it to me. In the rare cases that I've had to spend my own money on certain things, I submit the receipts and they reimburse me. This kind of process is just begging to have money and/or equipment stolen from them (as well as various other negative consequences for the company). This is simply not a process that a legitimate, competently run company would use.
For another thing, as others have indicated, this is an extremely common scam. Anyone who sends you money and asks you to send it back to them is immediately suspect. This is likely a variant of paper hanging (where they send you a known "bad" check and get you to give them the money as real cash) or a money mule scam (where they manipulate you into helping them launder stolen funds). I'm guessing that it's the former (since they're asking you to give them cash in exchange for a suspicious check that likely won't clear). If the check clears at all (and I suspect that it won't), it'll almost certainly be stolen money (in which case the transaction will likely eventually be reversed).