You can do a GET request to and the response will have an field with, well, and approximate guild count. It'll be accurate to the first three digits (145; 2,380; 156,000; etc). That will get you the guild(AKA "server") count.
As for user count, you need to use the gateway connection. On initial connection you're sent a event with a field that tells you how many members there are at that time. Then you'll have to listen for the and events to get real-time notification of when a member is added to or removed from a guild. However, that requires permission from Discord to use and they have said on several occasions that guild-member-count is not a valid use case to be able to use it.
If you're using a library they will have some way to get at least some of this info. What lib are you using? I can get you a link to their server