Your understanding is not that accurate. Neither is mine despite a semester in International Appellate Advocacy many years ago in law school.
The fact that all signatories to the UN Charter may be subject to the ICJ in some respects they might not be in respect to eachother. A country must specifically enter an agreement with another country. For example the US may agree to submit disputess with the UK to the ICJ whil at the same time refuse jurisdiction concerning disputes with Iraq.
Concerning the UN power consider that each Council member has one vote. Decisions on procedural matters are made by an affirmative vote of at least nine of the 15 members. Decisions onsubstantive matters require nine votes, including the concurring votes of all five permanent members. This is the rule of “great Power unanimity”, often referred to as the “veto” power.
Under the Charter, all Members of the United Nations agree to accept and carry out the decisions of the Security Council. While other organs of the United Nations make recommendations to Governments, **the Council alone has the power to take decisions which Member States are obligated under the Charter to carry out. **
Since the US is a permanent member of the security it may legally vetoe any attempt to enforce any portion of the charter against itself.
Who other than the UN can declare an nations act illegal. The UN has not and cannot declare the acts of the US illegal unless the US consents to it.